Exemple #1
0
 /// <summary>
 /// The name editor event handler
 /// </summary>
 /// <param name="sender">The sender</param>
 /// <param name="e">The event arguments</param>
 protected void namedComponentMouseEventHandler(object sender, MouseEventArgs e)
 {
     if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
     {
         return;
     }
     if (!e.IsArrowClick())
     {
         return;
     }
     if (!editorRect.Contains(e.X, e.Y))
     {
         if (captionEditor.Visible)
         {
             name = captionEditor.Text;
             updateNodes();
             captionEditor.Visible = false;
             UpdateForms();
             Refresh();
             return;
         }
     }
     else
     {
         captionEditor.Visible = true;
         captionEditor.Text    = name;
     }
 }
Exemple #2
0
        /// <summary>
        /// The on mouse down event handler
        /// </summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The event arguments</param>
        private void onMouseDownMoveEventHandler(object sender, MouseEventArgs e)
        {
            if (!e.IsArrowClick())
            {
                return;
            }
            IObjectLabel lab = Label;

            if (lab == null)
            {
                return;
            }
            PanelDesktop  desktop = Parent as PanelDesktop;
            PaletteButton active  = desktop.Tools.Active;

            if (active != null)
            {
                if (active.IsArrow & !(active.ReflectionType == null))
                {
                    try
                    {
                        ICategoryArrow arrow = desktop.Tools.Factory.CreateArrow(active);
                        arrow.Source              = lab.Object;
                        desktop.ActiveArrow       = arrow;
                        desktop.ActiveObjectLabel = lab;
                        return;
                    }
                    catch (Exception ex)
                    {
                        ex.ShowError(10);
                    }
                }
            }
        }
 /// <summary>
 /// The on mouse move event handler
 /// Draws correspond arrows
 /// </summary>
 /// <param name="sender">The sender</param>
 /// <param name="e">The event arguments</param>
 protected void MouseMove(object sender, MouseEventArgs e)
 {
     if (!e.IsArrowClick())
     {
         return;
     }
     if (pDesktop.ActiveArrow == null)
     {
         return;
     }
     pDesktop.DrawArrow(label as Control, e);
 }
Exemple #4
0
        /// <summary>
        /// The on mouse move event handler
        /// Draws correspond arrows
        /// </summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The event arguments</param>
        protected void onMouseMoveArrow(object sender, MouseEventArgs e)
        {
            PanelDesktop desktop = Parent as PanelDesktop;

            if (!e.IsArrowClick())
            {
                return;
            }
            if (desktop.ActiveArrow == null)
            {
                return;
            }
            desktop.DrawArrow(this, e);
        }
Exemple #5
0
        /// <summary>
        /// The on mouse up event handler
        /// </summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The event arguments</param>
        protected void onMouseUpMoveEventHandler(object sender, MouseEventArgs e)
        {
            isMoved         = false;
            Desktop.IsMoved = false;
            Desktop.SetBlocking(false);
            ICategoryArrow arrow = Desktop.ActiveArrow;

            if (!e.IsArrowClick())
            {
                return;
            }
            try
            {
                if (arrow == null)
                {
                    Desktop.Redraw();
                    return;
                }
                int x = Left + e.X;
                int y = Top + e.Y;
                for (int i = 0; i < Desktop.Controls.Count; i++)
                {
                    if (!(Desktop.Controls[i] is IChildObjectLabel) & !(Desktop.Controls[i] is IObjectLabel))
                    {
                        continue;
                    }
                    Control c = Desktop.Controls[i];
                    bool    hor = x <c.Left | x> c.Left + c.Width;
                    bool    vert = y <c.Top | y> c.Top + c.Height;
                    if (hor | vert)
                    {
                        continue;
                    }
                    IObjectLabel label = null;
                    if (Desktop.Controls[i] is IObjectLabel)
                    {
                        label = Desktop.Controls[i] as IObjectLabel;
                    }
                    else
                    {
                        IChildObjectLabel child = Desktop.Controls[i] as IChildObjectLabel;
                        label = child.Label;
                    }

                    arrow.Target = label.Object;
                    IArrowLabel lab = Desktop.Tools.Factory.CreateArrowLabel(Desktop.Tools.Active, arrow, this, label);
                    lab.Arrow.SetAssociatedObject(lab);
                    Desktop.AddArrowLabel(lab);
                    break;
                }
            }
            catch (Exception ex)
            {
                ex.ShowError(10);
                if (arrow != null)
                {
                    if (arrow is IRemovableObject)
                    {
                        IRemovableObject rem = arrow as IRemovableObject;
                        rem.RemoveObject();
                    }
                }
                ex.ShowError(1);;
            }
            Desktop.ActiveArrow = null;
            Desktop.Redraw();
        }