public void CopyFrom(ActionDeclaration copy)
 {
     Kind = copy.Kind;
     Relative = copy.Relative;
     Not = copy.Not;
     AppliesTo = copy.AppliesTo;
     Indent = copy.Indent;
     ListBox = copy.ListBox;
     ListIndex = copy.ListIndex;
     Arguments = new List<string>(copy.Arguments);
 }
 public void CopyFrom(ActionDeclaration copy)
 {
     Kind      = copy.Kind;
     Relative  = copy.Relative;
     Not       = copy.Not;
     AppliesTo = copy.AppliesTo;
     Indent    = copy.Indent;
     ListBox   = copy.ListBox;
     ListIndex = copy.ListIndex;
     Arguments = new List <string>(copy.Arguments);
 }
Esempio n. 3
0
 private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
 {
     if (!DesignMode)
     {
         if (e.Index < 0 || e.Index >= listBox1.Items.Count)
         {
             // because when deleting the last item in the list, this gets called with e.Index = -1. huh!??
             return;
         }
         e.DrawBackground();
         ActionDeclaration a = (ActionDeclaration)listBox1.Items[e.Index];
         e.Graphics.DrawImage(a.Kind.Image, Point.Add(e.Bounds.Location, new Size(a.Indent * 16 + 1, 1)));
         e.Graphics.DrawString(a.ListText, new Font(e.Font, a.FontStyle), new SolidBrush(e.ForeColor), new Point(e.Bounds.X + 26 + a.Indent * 16, e.Bounds.Y + 13 - (int)(e.Graphics.MeasureString(a.ListText, e.Font).Height / 2)));
         e.DrawFocusRectangle();
     }
 }
 public ActionDeclaration(ActionDeclaration copy)
 {
     CopyFrom(copy);
 }
 public ActionDeclaration(ActionDeclaration copy)
 {
     CopyFrom(copy);
 }
Esempio n. 6
0
 public ActionForm(ActionDeclaration a)
 {
     InitializeComponent();
     foreach (TreeNode n in Program.IDE.Objects.Node.Nodes)
         objectMenu.Items.Add(CreateResourceMenuItem(n, item_Click, null));
     initialsetting = true;
     pictureBoxAction.Image = a.Kind.Image;
     Text = a.Kind.Description;
     this.StartPosition = FormStartPosition.CenterParent;
     Arrows = new CheckBox[]{checkBoxSW, checkBoxS, checkBoxSE,
                             checkBoxW, checkBoxStop, checkBoxE,
                             checkBoxNW, checkBoxN, checkBoxNE
                             };
     ArgLabels = new Label[] { labelArg1, labelArg2, labelArg3, labelArg4, labelArg5, labelArg6 };
     ArgTextBoxes = new TextBox[] { textBoxArg1, textBoxArg2, textBoxArg3, textBoxArg4, textBoxArg5, textBoxArg6 };
     ArgMenus = new Button[] { buttonArg1, buttonArg2, buttonArg3, buttonArg4, buttonArg5, buttonArg6 };
     action = new ActionDeclaration(a);
     originalAction = a;
     this.radioButtonSelf.Checked = a.AppliesTo == -1;
     this.radioButtonOther.Checked = a.AppliesTo == -2;
     this.radioButtonObject.Checked = a.AppliesTo >= 0;
     this.panel1.Visible = this.radioButtonObject.Checked;
     this.label1.Text = action.AppliesTo == -1 ? "self" : action.AppliesTo == -2 ? "other" : Program.Objects.ContainsKey(action.AppliesTo) ? Program.Objects[action.AppliesTo].Name : "<undefined>";
     this.button1.Visible = this.radioButtonObject.Checked;
     this.checkBoxRelative.Checked = this.checkBoxArrowsRelative.Checked = a.Relative;
     this.checkBoxNot.Checked = this.checkBoxArrowsNot.Checked = a.Not;
     this.panelArrows.Visible = a.Kind.InterfaceKind == ActionInferfaceKind.Arrows;
     this.panelNormal.Visible = a.Kind.InterfaceKind == ActionInferfaceKind.Normal;
     this.groupBoxAppliesTo.Visible = a.Kind.ShowApplyTo;
     if (a.Kind.InterfaceKind == ActionInferfaceKind.Arrows)
     {
         for (int i = 0; i < 9; i++)
             Arrows[i].Checked = a.Arguments[0][i] != '0';
         textBoxSpeed.Text = a.Arguments[1];
         checkBoxArrowsRelative.Visible = a.Kind.ShowRelative;
         checkBoxArrowsNot.Visible = a.Kind.IsQuestion;
     }
     else
     {
         for (int i = 0; i < 6; i++)
         {
             if (i >= a.Arguments.Count)
             {
                 ArgLabels[i].Visible = false;
                 ArgTextBoxes[i].Visible = false;
                 ArgMenus[i].Visible = false;
             }
             else
             {
                 ArgLabels[i].Text = a.Kind.Arguments[i].Caption;
                 if (a.Kind.Arguments[i].Type == ActionArgumentType.FontString)
                 {
                     string[] sl = action.Arguments[i].Split(',');
                     int col = int.Parse(sl[2]);
                     ArgTextBoxes[i].ForeColor = Color.FromArgb(255, col & 255, (col >> 8) & 255, (col >> 16) & 255);
                     FontStyle fs = FontStyle.Regular;
                     if (sl[3] == "1")
                         fs |= FontStyle.Bold;
                     if (sl[4] == "1")
                         fs |= FontStyle.Italic;
                     if (sl[5] == "1")
                         fs |= FontStyle.Underline;
                     if (sl[6] == "1")
                         fs |= FontStyle.Strikeout;
                     ArgTextBoxes[i].Font = new Font(sl[0].Replace("\"", string.Empty), float.Parse(sl[1]), fs, GraphicsUnit.Point);
                 }
                 ArgTextBoxes[i].Text = ArgToString(i);
                 ActionArgumentType t = a.Kind.Arguments[i].Type;
                 ArgTextBoxes[i].ReadOnly = t != ActionArgumentType.Expression && t != ActionArgumentType.String && t != ActionArgumentType.Both;
                 if (a.Kind.Arguments[i].Type == ActionArgumentType.Color)
                 {
                     int col = int.Parse(action.Arguments[i]);
                     ArgTextBoxes[i].BackColor = Color.FromArgb(255, col & 255, (col >> 8) & 255, (col >> 16) & 255);
                 }
                 else
                     ArgTextBoxes[i].BackColor = Color.FromKnownColor(KnownColor.Window);
                 ArgTextBoxes[i].Tag = (object)i;
                 ArgMenus[i].Tag = (object)i;
                 bool hasmenu = true;
                 switch (a.Kind.Arguments[i].Type)
                 {
                     case ActionArgumentType.Expression:
                     case ActionArgumentType.String:
                     case ActionArgumentType.Both:
                         ArgMenus[i].Visible = hasmenu = false;
                         break;
                 }
                 if (hasmenu)
                 {
                     ArgTextBoxes[i].Click += new EventHandler(argument_Click);
                     ArgMenus[i].Click += new EventHandler(argument_Click);
                 }
             }
         }
         checkBoxRelative.Visible = a.Kind.ShowRelative;
         checkBoxNot.Visible = a.Kind.IsQuestion;
     }
     initialsetting = false;
 }
Esempio n. 7
0
 public void SetData(string format, bool autoConvert, object data)
 {
     a = (ActionDeclaration)data;
 }
Esempio n. 8
0
 public void SetData(string format, object data)
 {
     a = (ActionDeclaration)data;
 }
 public void SetData(object data)
 {
     a = (ActionDeclaration)data;
 }
Esempio n. 10
0
 public void SetData(object data)
 {
     a = (ActionDeclaration)data;
 }
Esempio n. 11
0
 public ActionDataObject(ActionDeclaration data)
 {
     a = data;
 }
Esempio n. 12
0
        private void listBox1_DragDrop(object sender, DragEventArgs e)
        {
            drag = false;
            CancelEventArgs t_e = new CancelEventArgs();

            BeforeActionDrop(this, t_e);
            if (t_e.Cancel)
            {
                return;
            }
            int y               = listBox1.PointToClient(new Point(e.X, e.Y)).Y;
            int i               = listBox1.TopIndex + (int)Math.Round((float)y / 26f);
            int absindex        = listBox1.TopIndex + y / 26;
            ActionDeclaration a = (ActionDeclaration)e.Data.GetData(typeof(ActionDeclaration));

            if (absindex == a.ListIndex && a.ListBox == listBox1)
            {
                return;
            }
            listBox1.BeginUpdate();
            bool lb = a.ListBox != null;

            if (i >= listBox1.Items.Count)
            {
                listBox1.Items.Add(a);
                listBox1.TopIndex = listBox1.Items.Count - 1;
            }
            else
            {
                listBox1.Items.Insert(i, a);
            }
            if (lb)
            {
                a.ListBox.Items.RemoveAt(i <= a.ListIndex && a.ListBox == listBox1 ? a.ListIndex + 1 : a.ListIndex);
            }
            a.ListBox = listBox1;
            int indent = 0;

            for (int j = 0; j < listBox1.Items.Count; j++)
            {
                ActionDeclaration ad = (ActionDeclaration)listBox1.Items[j];
                ad.ListIndex = j;
                ad.Indent    = indent;
                if (ad.Kind.Kind == ActionKind.BeginGroup)
                {
                    ad.Indent = ++indent;
                }
                else if (ad.Kind.Kind == ActionKind.EndGroup)
                {
                    ad.Indent = indent--;
                }
                if (indent < 0)
                {
                    indent = 0;
                }
            }
            foreach (int s in listBox1.SelectedIndices)
            {
                listBox1.SetSelected(s, false);
            }
            listBox1.SelectedIndex = a.ListIndex;
            listBox1.EndUpdate();
            if (!lb && a.Edit() == DialogResult.Cancel)
            {
                listBox1.Items.RemoveAt(a.ListIndex);
            }
            else
            {
                listBox1.Refresh();
                ActionDrop(this, EventArgs.Empty);
            }
        }
 public void SetData(string format, bool autoConvert, object data)
 {
     a = (ActionDeclaration)data;
 }
 public void SetData(string format, object data)
 {
     a = (ActionDeclaration)data;
 }
 public void SetData(Type format, object data)
 {
     a = (ActionDeclaration)data;
 }
Esempio n. 16
0
 public void SetData(Type format, object data)
 {
     a = (ActionDeclaration)data;
 }
Esempio n. 17
0
 public ActionForm(ActionDeclaration a)
 {
     InitializeComponent();
     foreach (TreeNode n in Program.IDE.Objects.Node.Nodes)
     {
         objectMenu.Items.Add(CreateResourceMenuItem(n, item_Click, null));
     }
     initialsetting         = true;
     pictureBoxAction.Image = a.Kind.Image;
     Text = a.Kind.Description;
     this.StartPosition = FormStartPosition.CenterParent;
     Arrows             = new CheckBox[] { checkBoxSW, checkBoxS, checkBoxSE,
                                           checkBoxW, checkBoxStop, checkBoxE,
                                           checkBoxNW, checkBoxN, checkBoxNE };
     ArgLabels      = new Label[] { labelArg1, labelArg2, labelArg3, labelArg4, labelArg5, labelArg6 };
     ArgTextBoxes   = new TextBox[] { textBoxArg1, textBoxArg2, textBoxArg3, textBoxArg4, textBoxArg5, textBoxArg6 };
     ArgMenus       = new Button[] { buttonArg1, buttonArg2, buttonArg3, buttonArg4, buttonArg5, buttonArg6 };
     action         = new ActionDeclaration(a);
     originalAction = a;
     this.radioButtonSelf.Checked   = a.AppliesTo == -1;
     this.radioButtonOther.Checked  = a.AppliesTo == -2;
     this.radioButtonObject.Checked = a.AppliesTo >= 0;
     this.panel1.Visible            = this.radioButtonObject.Checked;
     this.label1.Text               = action.AppliesTo == -1 ? "self" : action.AppliesTo == -2 ? "other" : Program.Objects.ContainsKey(action.AppliesTo) ? Program.Objects[action.AppliesTo].Name : "<undefined>";
     this.button1.Visible           = this.radioButtonObject.Checked;
     this.checkBoxRelative.Checked  = this.checkBoxArrowsRelative.Checked = a.Relative;
     this.checkBoxNot.Checked       = this.checkBoxArrowsNot.Checked = a.Not;
     this.panelArrows.Visible       = a.Kind.InterfaceKind == ActionInferfaceKind.Arrows;
     this.panelNormal.Visible       = a.Kind.InterfaceKind == ActionInferfaceKind.Normal;
     this.groupBoxAppliesTo.Visible = a.Kind.ShowApplyTo;
     if (a.Kind.InterfaceKind == ActionInferfaceKind.Arrows)
     {
         for (int i = 0; i < 9; i++)
         {
             Arrows[i].Checked = a.Arguments[0][i] != '0';
         }
         textBoxSpeed.Text = a.Arguments[1];
         checkBoxArrowsRelative.Visible = a.Kind.ShowRelative;
         checkBoxArrowsNot.Visible      = a.Kind.IsQuestion;
     }
     else
     {
         for (int i = 0; i < 6; i++)
         {
             if (i >= a.Arguments.Count)
             {
                 ArgLabels[i].Visible    = false;
                 ArgTextBoxes[i].Visible = false;
                 ArgMenus[i].Visible     = false;
             }
             else
             {
                 ArgLabels[i].Text = a.Kind.Arguments[i].Caption;
                 if (a.Kind.Arguments[i].Type == ActionArgumentType.FontString)
                 {
                     string[] sl  = action.Arguments[i].Split(',');
                     int      col = int.Parse(sl[2]);
                     ArgTextBoxes[i].ForeColor = Color.FromArgb(255, col & 255, (col >> 8) & 255, (col >> 16) & 255);
                     FontStyle fs = FontStyle.Regular;
                     if (sl[3] == "1")
                     {
                         fs |= FontStyle.Bold;
                     }
                     if (sl[4] == "1")
                     {
                         fs |= FontStyle.Italic;
                     }
                     if (sl[5] == "1")
                     {
                         fs |= FontStyle.Underline;
                     }
                     if (sl[6] == "1")
                     {
                         fs |= FontStyle.Strikeout;
                     }
                     ArgTextBoxes[i].Font = new Font(sl[0].Replace("\"", string.Empty), float.Parse(sl[1]), fs, GraphicsUnit.Point);
                 }
                 ArgTextBoxes[i].Text = ArgToString(i);
                 ActionArgumentType t = a.Kind.Arguments[i].Type;
                 ArgTextBoxes[i].ReadOnly = t != ActionArgumentType.Expression && t != ActionArgumentType.String && t != ActionArgumentType.Both;
                 if (a.Kind.Arguments[i].Type == ActionArgumentType.Color)
                 {
                     int col = int.Parse(action.Arguments[i]);
                     ArgTextBoxes[i].BackColor = Color.FromArgb(255, col & 255, (col >> 8) & 255, (col >> 16) & 255);
                 }
                 else
                 {
                     ArgTextBoxes[i].BackColor = Color.FromKnownColor(KnownColor.Window);
                 }
                 ArgTextBoxes[i].Tag = (object)i;
                 ArgMenus[i].Tag     = (object)i;
                 bool hasmenu = true;
                 switch (a.Kind.Arguments[i].Type)
                 {
                 case ActionArgumentType.Expression:
                 case ActionArgumentType.String:
                 case ActionArgumentType.Both:
                     ArgMenus[i].Visible = hasmenu = false;
                     break;
                 }
                 if (hasmenu)
                 {
                     ArgTextBoxes[i].Click += new EventHandler(argument_Click);
                     ArgMenus[i].Click     += new EventHandler(argument_Click);
                 }
             }
         }
         checkBoxRelative.Visible = a.Kind.ShowRelative;
         checkBoxNot.Visible      = a.Kind.IsQuestion;
     }
     initialsetting = false;
 }
 public ActionDataObject(ActionDeclaration data)
 {
     a = data;
 }