Esempio n. 1
0
        public static ParForm New(MainModel m, FunctionItem x)
        {
            // cleanup Forms
            List <Item> closedKeys = new List <Item>();

            foreach (Item y in Forms.Keys)
            {
                if (!Forms[y].Visible)
                {
                    closedKeys.Add(y);
                }
            }
            foreach (Item y in closedKeys)
            {
                Forms.Remove(y);
            }

            ParForm f = null;

            Forms.TryGetValue(x, out f);
            if (f == null)
            {
                f = new ParForm(m);
            }
            f.Reset(x);
            Forms[x] = f;
            if (f.WindowState == FormWindowState.Minimized)
            {
                f.WindowState = FormWindowState.Normal;
            }
            f.Show();
            f.BringToFront();
            return(f);
        }
Esempio n. 2
0
        public FunctionForm(MainModel Model, FunctionItem old)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();


            this.Model = Model;
            parForm    = new ParForm(Model);
            oldItem    = old;

            Reset();
        }
Esempio n. 3
0
 private void parClick(object sender, System.EventArgs e)
 {
     Apply();
     if (parForm.IsDisposed)
     {
         parForm = new ParForm(Model);
     }
     parForm.Reset(f);
     if (parForm.WindowState == FormWindowState.Minimized)
     {
         parForm.WindowState = FormWindowState.Normal;
     }
     parForm.Show();
     parForm.BringToFront();
 }
Esempio n. 4
0
            public override void OnClick(SourceGrid2.PositionEventArgs e)
            {
                base.OnClick(e);
                ItemsGrid g = (ItemsGrid)e.Grid;

                ParForm      f = (g[e.Position.Row, 2].Tag) as ParForm;
                FunctionItem x = (FunctionItem)(g[e.Position.Row, 0].Tag);

                if (f != null)
                {
                    if (f.IsDisposed)
                    {
                        f = new ParForm(((ItemsGrid)e.Grid).MainModel);
                        f.Reset(x);
                    }
                    f.Show();
                    f.BringToFront();
                }
            }
Esempio n. 5
0
        Item this[int i] {
            get { return(items[i]); }
            set {
                // set the first cell to the glass icon
                this[i + 1, 0] = new Link(null);
                SourceGrid2.VisualModels.Common vm = new SourceGrid2.VisualModels.Common();
                vm.Image                   = glassImg;
                vm.ImageAlignment          = SourceLibrary.Drawing.ContentAlignment.MiddleCenter;
                this[i + 1, 0].VisualModel = vm;
                this[i + 1, 0].Behaviors.Add(new BehaviorEdit());
                this[i + 1, 0].Tag = items[i];               // assign the item to the Tag field.

                // set the second cell to the delete icon
                this[i + 1, 1]             = new Link(null);
                vm                         = new SourceGrid2.VisualModels.Common();
                vm.Image                   = deleteImg;
                vm.ImageAlignment          = SourceLibrary.Drawing.ContentAlignment.MiddleCenter;
                this[i + 1, 1].VisualModel = vm;
                this[i + 1, 1].Behaviors.Add(new BehaviorDelete());
                this[i + 1, 1].Tag = i;               // assign the index to the Tag field.

                // set the third cell to the par icon
                vm = new SourceGrid2.VisualModels.Common();
                vm.ImageAlignment = SourceLibrary.Drawing.ContentAlignment.MiddleCenter;
                if (value is FunctionItem && ((FunctionItem)value).p.Count > 0)
                {
                    this[i + 1, 2] = new Link(null);
                    vm.Image       = parImg;
                    this[i + 1, 2].Behaviors.Add(new BehaviorPar());
                    ParForm f = new ParForm(MainModel);
                    f.Reset((FunctionItem)value);
                    this[i + 1, 2].Tag = f;
                }
                else
                {
                    this[i + 1, 2] = new SourceGrid2.Cells.Real.Cell();
                    vm.Image       = parDisabledImg;
                }
                this[i + 1, 2].VisualModel = vm;

                // set the fourth cell to the updown icon
                if (i < items.Count)
                {
                    this[i + 1, 3]    = new Link(null);
                    vm                = new SourceGrid2.VisualModels.Common();
                    vm.Image          = upDownImg;
                    vm.ImageAlignment = SourceLibrary.Drawing.ContentAlignment.MiddleCenter;
                    this[i + 1, 3].Behaviors.Add(new BehaviorDown());
                    this[i + 1, 3].VisualModel = vm;
                }
                else
                {
                    this[i + 1, 3] = new Cell();
                }

                this[i + 1, 4] = new SourceGrid2.Cells.Real.CheckBox(true); // add a checkbox
                this[i + 1, 5] = new Cell(value.Name);                      // add the item name
                this[i + 1, 5].Behaviors.Add(new BehaviorName());           // add doubleclick functionality
                this[i + 1, 6] = new Cell(value.TypeName());                // add the item's typename

                // Set ItemsModel
                if (items[i] != value)
                {
                    items[i] = value;
                }
                itemsOld[i] = value;
            }
        }