Exemplo n.º 1
0
/*
 *      public void Set(IStructuredSelectionCollection selection, IStructuredSelection weight, int nSel, int nWeght)
 *      {
 *          num[0, 0] = selections.IndexOf(selection);
 *          num[0, 1] = nSel;
 *          num[1, 0] = selections.IndexOf(weight);
 *          num[1, 1] = nWeght;
 *          post();
 *      }
 */

        /// <summary>
        /// Sets selection
        /// </summary>
        /// <param name="selection">Selection to set</param>
        /// <param name="nSel">Selection number</param>
        /// <param name="b">Existing sign</param>
        public void Set(IStructuredSelectionCollection selection, int nSel, bool b)
        {
            int k = b ? 0 : 1;

            num[k, 0] = selections.IndexOf(selection);
            num[k, 1] = nSel;
            post();
        }
Exemplo n.º 2
0
        private void radioButtonSel_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton rb = sender as RadioButton;

            if (!rb.Checked)
            {
                return;
            }
            object[] o = rb.Tag as object[];
            IStructuredSelectionCollection coll = o[0] as IStructuredSelectionCollection;
            int  n = (int)o[1];
            bool b = (bool)o[2];

            selection.Set(coll, n, b);
        }
Exemplo n.º 3
0
        private void fill(Panel p, bool b)
        {
            int k = b ? 0 : 1;

            int[,] num = selection.Numbers;
            int n = num[k, 0];
            int m = num[k, 1];
            IList <IStructuredSelectionCollection> l = selection.Selections;
            int y = 0;

            for (int i = 0; i < l.Count; i++)
            {
                IStructuredSelectionCollection   coll = l[i];
                CategoryTheory.IAssociatedObject ao   = coll as CategoryTheory.IAssociatedObject;
                IObjectLabel      lab = ao.Object as IObjectLabel;
                UserControlObject op  = new UserControlObject(null, lab);
                op.Left = 0;
                op.Top  = y;
                p.Controls.Add(op);
                y = op.Bottom + 5;
                int nSel = coll.Count;
                for (int j = 0; j < nSel; j++)
                {
                    IStructuredSelection sel = coll[j];
                    RadioButton          rb  = new RadioButton();
                    rb.CheckedChanged += radioButtonSel_CheckedChanged;
                    rb.Text            = sel.Name;
                    rb.Tag             = new object[] { coll, j, b };
                    if (n == i & m == j)
                    {
                        rb.Checked = true;
                    }
                    rb.Left = 5;
                    rb.Top  = y;
                    p.Controls.Add(rb);
                    y = rb.Bottom + 5;
                }
                Panel bl = new Panel();
                bl.BackColor = Color.Black;
                bl.Width     = p.Width - 10;
                bl.Left      = 0;
                bl.Top       = y;
                bl.Height    = 2;
                p.Controls.Add(bl);
                y = bl.Bottom + 5;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Costructor
        /// </summary>
        /// <param name="reg">Regression component</param>
        /// <param name="s">Selection</param>
        public RegressionSelectionUserControl(AliasRegression reg,
                                              IStructuredSelectionCollection s) : this()
        {
            this.s   = s;
            this.reg = reg;
            IAssociatedObject ao    = s as IAssociatedObject;
            IObjectLabel      label = ao.Object as IObjectLabel;

            name = label.RootName;//NamedComponent.GetText(label);
            Control c = new UserControlObject(null, label);

            c.Left = 0;
            c.Top  = 0;
            Controls.Add(c);
            int y = c.Height;

            for (int i = 0; i < s.Count; i++)
            {
                IStructuredSelection sel = s[i];
                Label l = new Label();
                l.Text = sel.Name;
                l.Top  = y + 10;
                l.Left = 10;
                Controls.Add(l);
                y = l.Top + l.Height;
                NumericUpDown n = new NumericUpDown();
                n.Minimum = -1;
                n.Value   = -1;
                n.Left    = 10;
                n.Top     = y + 10;
                y         = n.Top + n.Height + 20;
                Controls.Add(n);
                controls[n] = reg.GetRelativeName(s as IAssociatedObject) + "." + sel.Name;
            }
            Height = y;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Removes selection collecion
 /// </summary>
 /// <param name="selection">Selection to remove</param>
 public void Remove(IStructuredSelectionCollection selection)
 {
     selections.Remove(selection);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Adds selection collection
 /// </summary>
 /// <param name="selection">Selection to add</param>
 public void Add(IStructuredSelectionCollection selection)
 {
     selections.Add(selection);
 }
Exemplo n.º 7
0
 void IStructuredSelectionConsumer.Remove(IStructuredSelectionCollection selection)
 {
     selections.Remove(selection);
 }
Exemplo n.º 8
0
 void IStructuredSelectionConsumer.Add(IStructuredSelectionCollection selection)
 {
     selections.Add(selection);
 }