public McCurdyUmd1TEditorForm(UMD umd) : base(umd)
 {
     InitializeComponent();
     if ((umd != null) && !(umd is McCurdyUMD1T))
     {
         throw new ArgumentException($"Type of UMD should be {nameof(McCurdyUMD1T)}.", nameof(umd));
     }
 }
Example #2
0
 private void umdCurrentTextChangedHandler(UMD umd, string oldText, string newText)
 {
     if (InvokeRequired)
     {
         Invoke(new Action(() => umdCurrentTextChangedHandler(umd, oldText, newText)));
         return;
     }
     currentTextTextBox.Text = newText;
 }
Example #3
0
 /// <summary>
 /// Replace the style of the current text with the one the user specified
 /// </summary>
 /// <param Name="selection">The current selection</param>
 /// <param Name="arguments">The arguments provided to the command</param>
 public override void Execute(UMD.HCIL.PiccoloX.Util.PStyledTextHelpers.Selection selection, string[] arguments)
 {
     //If the selection exists, and the first argument is a style
     if (selection != null && arguments.Length > 0 && Styles.ContainsKey(arguments[0]))
     {
         //Apply that style to the text
         ApplyStyle(selection, Styles[arguments[0]]);
     }
 }
Example #4
0
        protected override void validateFields()
        {
            base.validateFields();
            UMD umd = (UMD)EditedModel;

            if (umd == null)
            {
                return;
            }
        }
Example #5
0
 public UmdEditorFormBase(UMD umd)
 {
     InitializeComponent();
     AddingNew = (umd == null);
     if (umd != null)
     {
         this.umd = umd;
         umd.CurrentTextChanged += umdCurrentTextChangedHandler;
     }
 }
Example #6
0
        protected override void _run(object[] argumentValues)
        {
            UMD umd = argumentValues[0] as UMD;

            if (umd == null)
            {
                return;
            }
            umd.UseStaticText = false;
        }
Example #7
0
 void Cell_MouseLeave(object sender, UMD.HCIL.Piccolo.Event.PInputEventArgs e)
 {
     fillBrush = (Selected ? lightBlueBrush : whiteBrush);
     if (HeaderCell != null)
     {
         HeaderCell.fillBrush = whiteBrush;
         HeaderCell.InvalidatePaint();
     }
     InvalidatePaint();
     //e.Handled = false;
 }
Example #8
0
 //public delegate void OnAnimationEndedDelegate();
 //public event OnAnimationEndedDelegate OnAnimationEnded;
 void Cell_MouseEnter(object sender, UMD.HCIL.Piccolo.Event.PInputEventArgs e)
 {
    MainForm.Instance.UpdateCell(this.RealValuesToString());
    fillBrush = hoverBrush;
    if (HeaderCell != null)
    {
        HeaderCell.fillBrush = fillBrush;
        HeaderCell.InvalidatePaint();
    }
    InvalidatePaint();
    //e.Handled = false;
    
 }
Example #9
0
        public McCurdyUmd1TEditorForm(UMD umd) : base(umd)
        {
            InitializeComponent();

            if (umd == null)
            {
                this.umd = new McCurdyUMD1T();
            }
            else if (!(umd is McCurdyUMD1T))
            {
                throw new ArgumentException();
            }
        }
Example #10
0
        private void createTallySourceSettingTab()
        {
            UMD umd = (UMD)EditedModel;

            talliesTable.Controls.Clear();
            if (umd.Type.TallyCount == 0)
            {
                mainTabControl.TabPages.Remove(talliesTabPage);
            }
            for (int i = 0; i < umd.Type.TallyCount; i++)
            {
                addRowToTallySourceSettingTable(i);
            }
        }
Example #11
0
        protected override void writeFields()
        {
            base.writeFields();
            UMD umd = (UMD)EditedModel;

            if (umd == null)
            {
                return;
            }
            umd.StaticText    = staticTextTextBox.Text;
            umd.UseStaticText = useStaticTextCheckBox.Checked;
            for (int i = 0; i < umd.Type.TallyCount; i++)
            {
                umd.SetTallySource(i, tallySourceDropDowns[i]?.SelectedValue as IBoolean);
            }
        }
Example #12
0
        protected override void _run(object[] argumentValues)
        {
            UMD umd = argumentValues[0] as UMD;

            if (umd == null)
            {
                return;
            }
            string text = argumentValues[1] as string;

            if (text == null)
            {
                return;
            }
            umd.StaticText    = text;
            umd.UseStaticText = true;
        }
Example #13
0
        protected override void loadData()
        {
            base.loadData();
            UMD umd = (UMD)EditedModel;

            if (umd == null)
            {
                return;
            }
            currentTextTextBox.Text       = umd.CurrentText;
            staticTextTextBox.Text        = umd.StaticText;
            useStaticTextCheckBox.Checked = umd.UseStaticText;
            createTallySourceSettingTab();
            for (int i = 0; i < umd.Type.TallyCount; i++)
            {
                tallySourceDropDowns[i]?.SelectByValue(umd.GetTallySource(i));
            }
        }
Example #14
0
        /// <summary>
        /// Change nodevisibility.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void PPathwayLayer_VisibleChanged(object sender, UMD.HCIL.Piccolo.Event.PPropertyEventArgs e)
        {
            foreach (PPathwayObject obj in this.GetNodes())
            {
                obj.Visible = this.Visible;
                obj.Pickable = this.Visible;
                if (!(obj is PPathwayEntity))
                    continue;

                PPathwayEntity node = (PPathwayEntity)obj;
                foreach (PPathwayEdge line in node.Edges)
                {
                    line.VisibleChange();
                }
            }
        }
Example #15
0
 /// <summary>
 /// If the user clicks anywhere, remove the error
 /// </summary>
 public override void OnMouseDown(UMD.HCIL.Piccolo.Event.PInputEventArgs e)
 {
     base.OnMouseDown(e);
     closeMessage();
 }
Example #16
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="e"></param>
        public override void OnMouseDown(UMD.HCIL.Piccolo.Event.PInputEventArgs e)
        {
            base.OnMouseDown(e);

            // Set Focus
            m_variable.Selected = true;
        }
Example #17
0
 public override IModelEditorForm <UMD> GetInstance(UMD modelInstance)
 {
     return(new McCurdyUmd1TEditorForm(modelInstance));
 }
Example #18
0
		//****************************************************************
		// Painting - Methods for painting a PText.
		//****************************************************************

		/// <summary>
		/// Overridden.  See <see cref="PNode.Paint">PNode.Paint</see>.
		/// </summary>
		protected override void Paint(UMD.HCIL.Piccolo.Util.PPaintContext paintContext) {
			base.Paint(paintContext);

			if (text != null && textBrush != null && font != null) {
				Graphics g = paintContext.Graphics;

				float renderedFontSize = font.SizeInPoints * paintContext.Scale;
				if (renderedFontSize < PUtil.GreekThreshold) {
					
					// .NET bug: DrawString throws a generic gdi+ exception when
					// the scaled font size is very small.  So, we will render
					// the text as a simple rectangle for small fonts
					g.FillRectangle(textBrush, Bounds);
				}
				else if (renderedFontSize < PUtil.MaxFontSize) {
					Font renderFont = font;

					// The font needs to be adjusted for printing.
					if (g.DpiY != GRAPHICS.DpiY) {
						float fPrintedFontRatio = GRAPHICS.DpiY / 100;
						renderFont = new Font(font.Name, font.Size * fPrintedFontRatio,
							font.Style, font.Unit);
					}

					g.DrawString(text, renderFont, textBrush, Bounds, stringFormat);
				}
			}
		}
 public new IModelEditorForm <UMD> GetInstanceT(UMD modelInstance) => new McCurdyUmd1TEditorForm(modelInstance);
Example #20
0
        /// <summary>
        /// Perform the search
        /// </summary>
        public override void Execute(object sender, UMD.HCIL.Piccolo.Event.PInputEventArgs e)
        {
            //If the user is highlighting the last jump, do that
            if (SearchType == Direction.Highlight) { Highlight(); }
            //If the user is searching, perform the search
            else if (SearchType == Direction.Forward || SearchType == Direction.Backward) { Search(); }

            //Reset the direction detection flags
            _ForwardPressed = _BackPressed = false;
            SearchType = Direction.None;
        }
Example #21
0
        protected override void Paint(UMD.HCIL.PocketPiccolo.Util.PPaintContext paintContext)
        {
            Graphics2D g = paintContext.Graphics;

            if (points.Count > 0) {
                if (Brush != null && closed) {
                    g.FillPolygon(Brush, (PointF[])points.ToArray(typeof(PointF)));
                }

                if (pen != null) {
                    if (closed) {
                        g.DrawPolygon(pen, (PointF[])points.ToArray(typeof(PointF)));
                    } else {
                        for (int i = 0; i < points.Count-1; i++) {
                            g.DrawLine(pen, (PointF)points[i], (PointF)points[i+1]);
                        }
                    }
                }
            }
        }
Example #22
0
		//****************************************************************
		// Painting - Methods for painting a PText.
		//****************************************************************

		/// <summary>
		/// Overridden.  See <see cref="PNode.Paint">PNode.Paint</see>.
		/// </summary>
		protected override void Paint(UMD.HCIL.Piccolo.Util.PPaintContext paintContext) {
			base.Paint (paintContext);
			Device device = (paintContext as P3PaintContext).Device;

			PMatrix currMatrix = (paintContext as P3PaintContext).Transform;

			// Scale the matrix down to display font units
			float scale = displayFontSize / font.Size;
			currMatrix.ScaleBy(scale, X, Y);

			float[] piccoloMatrixElements = currMatrix.Elements;
			if (!currMatrix.IsIdentity) {
				Matrix m = new Matrix();
				m.M11 = piccoloMatrixElements[0];
				m.M12 = piccoloMatrixElements[1];
				m.M21 = piccoloMatrixElements[2];
				m.M22 = piccoloMatrixElements[3];
				m.M41 = piccoloMatrixElements[4];
				m.M42 = piccoloMatrixElements[5];
				m.M33 = 1;
				m.M44 = 1;
				textSprite.Transform = m;
			}

			textSprite.Begin(SpriteFlags.None);
			DrawTextFormat D3DAlignment = P3Util.GetD3DAlignment(stringFormat.Alignment);
			
			// Calculate the rectangle with no padding, in actual font units
			scale = 1 / scale;
			int totHzPadding = currLeftPadding+currRightPadding;
			int totVtPadding = currTopPadding+currBottomPadding;

			Rectangle dstRect = new Rectangle((int)(Bounds.X+currLeftPadding*scale), (int)(Bounds.Y+currTopPadding*scale),
				(int)((Bounds.Width-totHzPadding)*scale), (int)((Bounds.Height-totVtPadding)*scale));

			// Wrap the string ourselves, instead of letting the draw method do it, since we want to make
			// sure it's consistent with our own MeasureString method.
			String str = P3Util.WrapString(textSprite, D3Dfont, Text, dstRect.Width, (TextBrush as SolidBrush).Color);
			D3Dfont.DrawText(textSprite, str, dstRect, D3DAlignment, (TextBrush as SolidBrush).Color);
			textSprite.End();
		}
Example #23
0
        /// <summary>
        /// When the user clicks on the PStyledText,
        /// Activate it, clear any selection, and move the carat to the nearest character that they clicked on
        /// </summary>
        /// <param name="end">The MouseDown event arguments</param>
        public override void OnMouseDown(UMD.HCIL.Piccolo.Event.PInputEventArgs e)
        {
            base.OnMouseDown(e);
            if (e.Button == MouseButtons.Left)
            {
                Active = true;

                if (ChangeSelection != null) { ChangeSelection(Selection, null); }

                Model.SelectionStart = Model.GetCharIndexFromPosition(Model.GlobalToModel(e.Position));
                UpdateCarat();
            }
        }
Example #24
0
        //****************************************************************
        // Painting - Methods for painting a PText.
        //****************************************************************
        /// <summary>
        /// Overridden.  See <see cref="PNode.Paint">PNode.Paint</see>.
        /// </summary>
        protected override void Paint(UMD.HCIL.PocketPiccolo.Util.PPaintContext paintContext)
        {
            base.Paint(paintContext);

            if (text != null && textBrush != null && font != null) {
                Graphics2D g = paintContext.Graphics;

                float renderedFontSize = font.Size * paintContext.Scale;
                    //font.SizeInPoints * paintContext.Scale;
                if (renderedFontSize < PUtil.GreekThreshold) {

                    // .NET bug: DrawString throws a generic gdi+ exception when
                    // the scaled font size is very small.  So, we will render
                    // the text as a simple rectangle for small fonts
                    g.FillRectangle(textBrush, Bounds);
                }
                else if (renderedFontSize < PUtil.MaxFontSize) {
                    g.DrawString(text, font, textBrush, Bounds); //, stringFormat);
                }
            }
        }
Example #25
0
 /// <summary>
 /// If the PStyledText is assigned keyboard focus, direct it instead to the Model
 /// </summary>
 /// <param name="end">The GotFocus event arguments</param>
 public override void OnGotFocus(UMD.HCIL.Piccolo.Event.PInputEventArgs e)
 {
     base.OnGotFocus(e);
     Active = true;
 }
Example #26
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="e"></param>
        public override void OnDoubleClick(UMD.HCIL.Piccolo.Event.PInputEventArgs e)
        {
            base.OnDoubleClick(e);
            if(m_canvas == null || m_ecellObj == null)
                return;

            Minimize();
        }
Example #27
0
 public UmdEditorFormBase(UMD umd) : base(umd)
 {
     InitializeComponent();
     ((UMD)EditedModel).CurrentTextChanged += umdCurrentTextChangedHandler;
 }