Exemplo n.º 1
0
        virtual public void AddRow(Control c)
        {
            tableLayoutPanel1.AutoSize = !mbAutoScroll;
            int oldHeight = tableLayoutPanel1.Height;

            //tableLayoutPanel1.AutoSize = true;
            //tableLayoutPanel1.RowStyles.Insert(mControls.Count, new RowStyle(SizeType.AutoSize));
            tableLayoutPanel1.RowStyles.Insert(mControls.Count, new RowStyle(SizeType.Absolute, c.Height));
            tableLayoutPanel1.Controls.Add(c, 1, mControls.Count);

            SuperListDragButton sb = new SuperListDragButton(this);

            sb.Tag  = c;
            sb.Dock = DockStyle.Fill;
            tableLayoutPanel1.Controls.Add(sb, 0, mControls.Count);

            //tableLayoutPanel1.AutoScroll = true;
            //tableLayoutPanel1.AutoScrollMargin = new Size(5, 0);
            //tableLayoutPanel1.AutoScrollMargin.Width = 3;

            int change = tableLayoutPanel1.Height - oldHeight;

            //todo.. notify parent of height change in a proper way
            if (this.Parent != null && this.Parent.Parent != null)
            {
                this.Parent.Parent.Height += change;
            }

            mControls.Add(c);

            if (NeedsResize != null)
            {
                NeedsResize(this, null);
            }
        }
Exemplo n.º 2
0
        override public void HandleDrop(DragEventArgs e, SuperListDragButton otherButton, SuperListDragButton thisButton)
        {
            FunctorEditor ctrlMove   = otherButton.Tag as FunctorEditor;
            FunctorEditor ctrlTarget = thisButton.Tag as FunctorEditor;

            if (e.Effect == DragDropEffects.Move)
            {
                if (ctrlMove.LogicalHost == ctrlTarget.LogicalHost && ctrlMove.Parent == ctrlTarget.Parent)
                {
                    this.OnReOrderRequest(otherButton, thisButton);
                }
                else if (ctrlMove.LogicalHost.GetType() == ctrlTarget.LogicalHost.GetType())
                {
                    SuperList senderParent = otherButton.GetParentList();
                    senderParent.OnTransferRequest(this, otherButton);
                    //return DragDropEffects.Move;
                }
                else
                {
                    MessageBox.Show("asdf");
                }
            }
            else if (e.Effect == DragDropEffects.Copy)
            {
                if (ctrlMove.LogicalHost.GetType() == ctrlTarget.LogicalHost.GetType())
                {
                    SuperList senderParent = otherButton.GetParentList();
                    senderParent.OnCopyRequest(this, otherButton);
                    //return DragDropEffects.Move;
                }
            }
        }
Exemplo n.º 3
0
        //protected virtual OnReorder(SuperListDragButton )
        //??

        //on delete row...
        virtual public void OnDelete(SuperListDragButton button)
        {
            int rowid = tableLayoutPanel1.GetRow(button);

            tableLayoutPanel1.SuspendLayout();

            Control innerControl = button.Tag as Control;

            if (innerControl != null)
            {
                tableLayoutPanel1.Controls.Remove(innerControl);
                mControls.Remove(innerControl);
            }
            tableLayoutPanel1.Controls.Remove(button);

            tableLayoutPanel1.RowStyles.RemoveAt(rowid);
            MoveControlsUpN(tableLayoutPanel1, rowid, 1);

            tableLayoutPanel1.ResumeLayout();

            if (NeedsResize != null)
            {
                NeedsResize(this, null);
            }
        }
Exemplo n.º 4
0
        //protected

        private void SuperListDragButton_DragEnter(object sender, DragEventArgs e)
        {
            e.Effect = DragDropEffects.None;
            if (e.Data.GetDataPresent(typeof(SuperListDragButton)))
            {
                object data = e.Data.GetData(typeof(SuperListDragButton));
                SuperListDragButton otherButton = data as SuperListDragButton;
                if (otherButton != null)
                {
                    e.Effect = mParent.ValidateDragTarget(otherButton, this, e);
                }
                //e.Effect = DragDropEffects.Move;
            }

            ////DataFormat
            //if (e.Data.GetDataPresent(DataFormats.Bitmap))
            //{
            //   //e.Effect = DragDropEffects.Copy;
            //}
            //else
            //{
            //   Type o = e.Data.GetType();
            //   //e.Effect = DragDropEffects.None;
            //}
            //if (mbDebugColors)
            //   this.BackColor = Color.GreenYellow;

            //this.BackColor = mDragOverColor;
        }
Exemplo n.º 5
0
        //private void SuperListDragButton_DragDrop(object sender, DragEventArgs e)
        //{
        //   object data = e.Data.GetData(typeof(SuperListDragButton));
        //   SuperListDragButton otherButton = data as SuperListDragButton;
        //   if(otherButton != null)
        //   {
        //      FunctorEditor ctrlMove = otherButton.Tag as FunctorEditor;
        //      FunctorEditor ctrlTarget = this.Tag as FunctorEditor;

        //      if(e.Effect == DragDropEffects.Move)
        //      {
        //         if (ctrlMove.LogicalHost == ctrlTarget.LogicalHost)
        //         {
        //            mParent.OnReOrderRequest(otherButton, this);
        //         }
        //         else if (ctrlMove.LogicalHost.GetType() == ctrlTarget.LogicalHost.GetType())
        //         {
        //            SuperList senderParent = otherButton.GetParentList();
        //            senderParent.OnTransferRequest(mParent, otherButton);
        //            //return DragDropEffects.Move;
        //         }

        //      }


        //   }

        //}


        private void SuperListDragButton_DragDrop(object sender, DragEventArgs e)
        {
            object data = e.Data.GetData(typeof(SuperListDragButton));
            SuperListDragButton otherButton = data as SuperListDragButton;

            if (otherButton != null)
            {
                mParent.HandleDrop(e, otherButton, this);
            }
        }
Exemplo n.º 6
0
        public virtual void OnCopyRequest(SuperList otherlist, SuperListDragButton toMove)//, SuperListDragButton target)
        {
            //Control c = toMove.Tag as Control;
            ////otherlist.re
            //OnDelete(toMove);
            //otherlist.AddRow(c);

            //OnReordered();
            //otherlist.OnReordered();

            //if (NeedsResize != null)
            //   NeedsResize(this, null);
        }
Exemplo n.º 7
0
        public override void OnDelete(SuperListDragButton button)
        {
            PropertyFlowList flow     = button.Tag as PropertyFlowList;
            object           toDelete = flow.SelectedObject;

            mObjectList.Remove(toDelete);
            base.OnDelete(button);

            //ObjectDeleted
            if (ObjectDeleted != null)
            {
                ObjectDeleted.Invoke(flow, toDelete);
            }
        }
Exemplo n.º 8
0
        public void OnTransferRequest(SuperList otherlist, SuperListDragButton toMove)//, SuperListDragButton target)
        {
            Control c = toMove.Tag as Control;

            //otherlist.re
            OnDelete(toMove);
            otherlist.AddRow(c);

            OnReordered();
            otherlist.OnReordered();

            if (NeedsResize != null)
            {
                NeedsResize(this, null);
            }
        }
Exemplo n.º 9
0
        public void OnReOrderRequest(SuperListDragButton toMove, SuperListDragButton target)
        {
            Control ctrlMove   = toMove.Tag as Control;
            Control ctrlTarget = target.Tag as Control;

            ReOrder(tableLayoutPanel1, tableLayoutPanel1.GetRow(toMove), tableLayoutPanel1.GetRow(target));
            //if (DoReorder(ctrlMove, ctrlTarget))
            //{
            //}
            OnReordered();

            if (NeedsResize != null)
            {
                NeedsResize(this, null);
            }
        }
Exemplo n.º 10
0
        override public DragDropEffects ValidateDragTarget(Control toMove, Control target, DragEventArgs e)
        {
            FunctorEditor ctrlMove   = toMove.Tag as FunctorEditor;
            FunctorEditor ctrlTarget = target.Tag as FunctorEditor;

            SuperList targetList = target as SuperList;

            //to empty list
            if (targetList != null)
            {
                SuperListDragButton button = toMove as SuperListDragButton;
                if (targetList.GetType() == button.GetParentList().GetType())
                {
                    if ((e.KeyState & 8) == 8 && (e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy)
                    {
                        return(DragDropEffects.Copy);
                    }
                    else
                    {
                        return(DragDropEffects.Move);
                    }
                }
            }
            if (ctrlMove == null || ctrlTarget == null)
            {
                return(DragDropEffects.None);
            }

            if ((e.KeyState & 8) == 8 && (e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy)
            {
                return(DragDropEffects.Copy);
            }
            else if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move)
            {
                if (ctrlMove.LogicalHost == ctrlTarget.LogicalHost)
                {
                    return(DragDropEffects.Move);
                }
                else if (ctrlMove.LogicalHost.GetType() == ctrlTarget.LogicalHost.GetType())
                {
                    return(DragDropEffects.Move);
                }
            }

            return(DragDropEffects.None);
        }
Exemplo n.º 11
0
 void SuperList_DragEnter(object sender, DragEventArgs e)
 {
     if (mControls.Count > 0)
     {
         return;
     }
     e.Effect = DragDropEffects.None;
     if (e.Data.GetDataPresent(typeof(SuperListDragButton)))
     {
         object data = e.Data.GetData(typeof(SuperListDragButton));
         SuperListDragButton otherButton = data as SuperListDragButton;
         if (otherButton != null)
         {
             e.Effect = ValidateDragTarget(otherButton, this, e);
         }
         //e.Effect = DragDropEffects.Move;
     }
 }
Exemplo n.º 12
0
        override public void HandleDrop(DragEventArgs e, SuperListDragButton otherButton, SuperListDragButton thisButton)
        {
            PropertyFlowList ctrlMove   = otherButton.Tag as PropertyFlowList;
            PropertyFlowList ctrlTarget = thisButton.Tag as PropertyFlowList;

            if (e.Effect == DragDropEffects.Move)
            {
                //if (ctrlMove.SelectedObject == ctrlTarget.SelectedObject)
                if (ctrlMove.Parent == ctrlTarget.Parent)
                {
                    this.OnReOrderRequest(otherButton, thisButton);
                }
                else if (ctrlMove.SelectedObject.GetType() == ctrlTarget.SelectedObject.GetType())
                {
                    SuperList senderParent = otherButton.GetParentList();
                    senderParent.OnTransferRequest(this, otherButton);
                    //return DragDropEffects.Move;
                }
            }
        }
Exemplo n.º 13
0
        virtual public void HandleDrop(DragEventArgs e, SuperListDragButton otherButton, SuperListDragButton thisButton)
        {
            //FunctorEditor ctrlMove = otherButton.Tag as FunctorEditor;
            //FunctorEditor ctrlTarget = thisButton.Tag as FunctorEditor;

            //if (e.Effect == DragDropEffects.Move)
            //{
            //   if (ctrlMove.LogicalHost == ctrlTarget.LogicalHost)
            //   {
            //      this.OnReOrderRequest(otherButton, thisButton);
            //   }
            //   else if (ctrlMove.LogicalHost.GetType() == ctrlTarget.LogicalHost.GetType())
            //   {
            //      SuperList senderParent = otherButton.GetParentList();
            //      senderParent.OnTransferRequest(this, otherButton);
            //      //return DragDropEffects.Move;
            //   }

            //}
        }
Exemplo n.º 14
0
        public override void OnDelete(SuperListDragButton button)
        {
            bool          deleteWorked = false;
            FunctorEditor f            = button.Tag as FunctorEditor;

            if (f != null)
            {
                TriggerCondition cond = f.Tag as TriggerCondition;
                if (f != null)
                {
                    if (ParentTriggerNamespace.DeleteCondition(Trigger, cond, true))
                    {
                        base.OnDelete(button);
                        deleteWorked = true;
                    }
                }
            }
            if (deleteWorked == false)
            {
                CoreGlobals.getErrorManager().OnSimpleWarning("Error deleting condition.");
            }
        }
Exemplo n.º 15
0
        public override void OnDelete(SuperListDragButton button)
        {
            bool          deleteWorked = false;
            FunctorEditor f            = button.Tag as FunctorEditor;

            if (f != null)
            {
                TriggerEffect effect = f.Tag as TriggerEffect;
                if (f != null)
                {
                    if (ParentTriggerNamespace.DeleteEffect(Trigger, effect, EffectsOnFalse, true))
                    {
                        base.OnDelete(button);
                        deleteWorked = true;
                    }
                }
            }
            if (deleteWorked == false)
            {
                CoreGlobals.getErrorManager().OnSimpleWarning("Error deleting effect.");
            }
        }
Exemplo n.º 16
0
        public override void OnCopyRequest(SuperList otherlist, SuperListDragButton toMove)
        {
            //base.OnCopyRequest(otherlist, toMove);
            Control       c = toMove.Tag as Control;
            FunctorEditor f = c as FunctorEditor;

            if (f == null)
            {
                return;
            }
            TriggerCondition comp = f.Tag as TriggerCondition;

            if (comp == null)
            {
                return;
            }
            //comp.CopyTo

            TriggerControl trigCont = otherlist.Parent.Parent as TriggerControl;

            TriggerClipboard temp = new TriggerClipboard();

            //temp.CopyValues(this.mParentTriggerNamespace.GetValueList());
            temp.mValues = this.ParentTriggerNamespace.GetValues();

            int newID;
            TriggerCondition e = temp.GetCondition(comp, this.mParentTriggerNamespace);

            ConditionsList ef = otherlist as ConditionsList;

            //mParentTriggerNamespace.InsertCondition(trigCont.Trigger.ID, e, temp.mValues, out newID);
            mParentTriggerNamespace.InsertCondition(trigCont.Trigger.ID, e, this.ParentTriggerNamespace.GetValues(), out newID);


            ef.AddExistingConditionToUI(e, this.mParentTriggerNamespace.GetValues());

            mParentTriggerNamespace.ProcessVarMapping();
        }
Exemplo n.º 17
0
 void SuperList_DragDrop(object sender, DragEventArgs e)
 {
     if (mControls.Count == 0)
     {
         if (e.Data.GetDataPresent(typeof(SuperListDragButton)))
         {
             object data = e.Data.GetData(typeof(SuperListDragButton));
             SuperListDragButton otherButton = data as SuperListDragButton;
             if (otherButton != null)
             {
                 SuperList senderParent = otherButton.GetParentList();
                 if (e.Effect == DragDropEffects.Move)
                 {
                     senderParent.OnTransferRequest(this, otherButton);
                 }
                 else if (e.Effect == DragDropEffects.Copy)
                 {
                     senderParent.OnCopyRequest(this, otherButton);
                 }
             }
         }
     }
 }