Пример #1
0
 //-----------------------------------------------------------------
 public override void OnMouseUpNonStandard(object sender, MouseEventArgs e)
 {
     if ((ModeSourisCustom == EModeSourisCustom.LienWorkflow) && e.Button == MouseButtons.Left)
     {
         Point ptLogique = GetLogicalPointFromDisplay(new Point(e.X, e.Y));
         m_objetEndJoin = ObjetEdite.SelectionnerElementDuDessus(ptLogique) as CWorkflowEtapeDessin;
         if (m_objetEndJoin != null && m_objetEndJoin != m_objetStartJoin)
         {
             if (m_objetEndJoin != null)
             {
                 if (ModeSourisCustom == EModeSourisCustom.LienWorkflow)
                 {
                     if (m_objetStartJoin != null && m_objetEndJoin != null)
                     {
                         m_etapeStartLienACreer = m_objetStartJoin;
                         m_etapeEndLienACreer   = m_objetEndJoin;
                         if (m_etapeStartLienACreer.TypeEtape != null && m_etapeStartLienACreer.TypeEtape.Bloc != null &&
                             m_etapeStartLienACreer.TypeEtape.Bloc.CodesRetourPossibles.Length > 0)
                         {
                             ShowMenuCreateLien();
                         }
                         else
                         {
                             CreateLien("");
                         }
                     }
                 }
             }
         }
         m_objetStartJoin = null;
     }
 }
Пример #2
0
 //-----------------------------------------------------------------
 public override void OnMouseUpNonStandard(object sender, MouseEventArgs e)
 {
     if (ModeSourisCustom == EModeSourisCustom.Join && e.Button == MouseButtons.Left)
     {
         Point     ptLogique = GetLogicalPointFromDisplay(new Point(e.X, e.Y));
         CODEQBase table     = ObjetEdite.SelectionnerElementDuDessus(ptLogique) as CODEQBase;
         if (table != null && table != m_table1Join)
         {
             IColumnDeEasyQuery colEndJoin = table.GetColonneAt(ptLogique);
             if (colEndJoin != null)
             {
                 CODEQJointure jointure = new CODEQJointure();
                 jointure.Parent         = ObjetEdite;
                 jointure.ElementsSource = new IObjetDeEasyQuery[] { m_table1Join, table };
                 jointure.NomFinal       = m_table1Join.NomFinal + "-" + table.NomFinal;
                 if (jointure.AddParametre(m_colStartJoin, colEndJoin))
                 {
                     Rectangle rct = Rectangle.Union(m_table1Join.RectangleAbsolu, table.RectangleAbsolu);
                     rct.Offset(rct.Width / 2 - jointure.Size.Width / 2, rct.Height / 2 - jointure.Size.Height / 2);
                     jointure.Position = new Point(rct.Left, rct.Top);
                     ObjetEdite.AddChild(jointure);
                     ModeSouris = EModeSouris.Selection;
                 }
             }
         }
         m_colStartJoin = null;
         m_table1Join   = null;
         Refresh();
     }
 }
Пример #3
0
        //-----------------------------------------------------------------
        public override void OnMouseMoveNonStandard(object sender, MouseEventArgs e)
        {
            if ((ModeSourisCustom == EModeSourisCustom.LienWorkflow) &&
                m_objetStartJoin != null && e.Button == MouseButtons.Left)
            {
                Graphics g = CreateGraphics();

                Point ptCentre = new Point(m_rectStartLien.Left + m_rectStartLien.Width / 2,
                                           m_rectStartLien.Top + m_rectStartLien.Height / 2);
                Rectangle rct = m_rectLien;

                Point          ptLogique = GetLogicalPointFromDisplay(new Point(e.X, e.Y));
                IWorflowDessin dest      = ObjetEdite.SelectionnerElementDuDessus(ptLogique) as IWorflowDessin;
                if (dest == m_objetStartJoin)
                {
                    dest = null;
                }
                Rectangle rctDest = new Rectangle(e.X, e.Y, 1, 1);
                if (dest != null)
                {
                    rctDest = dest.RectangleAbsolu;
                    rctDest = new Rectangle(GetDisplayPointFromLogical(rctDest.Location),
                                            GetDisplaySizeFromLogical(rctDest.Size));
                }

                rct.Inflate(2, 2);
                using (Bitmap bmp = DernierApercuToDispose)
                    g.DrawImage(bmp, rct, rct, GraphicsUnit.Pixel);


                if (Control.ModifierKeys == Keys.Control)
                {
                    Brush br = new SolidBrush(Color.FromArgb(128, 255, 0, 0));
                    g.FillRectangle(br, m_rectStartLien);
                    m_rectLien = m_rectStartLien;
                }
                else
                {
                    Pen pen = new Pen(Color.Blue);
                    pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
                    Brush br = new SolidBrush(Color.FromArgb(128, 0, 0, 255));
                    g.FillRectangle(br, m_rectStartLien);
                    if (dest != null)
                    {
                        g.FillRectangle(br, rctDest);
                    }
                    br.Dispose();
                    g.DrawLine(pen, ptCentre, new Point(e.X, e.Y));
                    pen.Dispose();
                    g.Dispose();
                    m_rectLien = Rectangle.Union(m_rectStartLien, rctDest);
                }
            }
        }
Пример #4
0
        //-----------------------------------------------------------------
        public override void OnMouseMoveNonStandard(object sender, MouseEventArgs e)
        {
            if (ModeSourisCustom == EModeSourisCustom.Join && m_colStartJoin != null && e.Button == MouseButtons.Left)
            {
                Graphics g = CreateGraphics();

                Point ptCentre = new Point(m_rectColStartJoin.Left + m_rectColStartJoin.Width / 2,
                                           m_rectColStartJoin.Top + m_rectColStartJoin.Height / 2);
                Rectangle rct = m_rectJoin;

                Point ptLogique            = GetLogicalPointFromDisplay(new Point(e.X, e.Y));
                IColumnDeEasyQuery colDest = null;
                CODEQBase          dest    = ObjetEdite.SelectionnerElementDuDessus(ptLogique) as CODEQBase;
                if (dest == m_table1Join)
                {
                    dest = null;
                }
                colDest = dest != null?dest.GetColonneAt(ptLogique) : null;

                Rectangle rctDest = new Rectangle(e.X, e.Y, 1, 1);
                if (colDest != null)
                {
                    rctDest = dest.GetRectAbsoluColonne(colDest);
                    rctDest = new Rectangle(GetDisplayPointFromLogical(rctDest.Location),
                                            GetDisplaySizeFromLogical(rctDest.Size));
                }

                rct.Inflate(2, 2);
                using (Bitmap bmp = DernierApercuToDispose)
                    g.DrawImage(bmp, rct, rct, GraphicsUnit.Pixel);
                Pen pen = new Pen(Color.Blue);
                pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
                Brush br = new SolidBrush(Color.FromArgb(128, 0, 0, 255));
                g.FillRectangle(br, m_rectColStartJoin);
                if (colDest != null)
                {
                    g.FillRectangle(br, rctDest);
                }
                br.Dispose();
                g.DrawLine(pen, ptCentre, new Point(e.X, e.Y));
                pen.Dispose();
                g.Dispose();
                m_rectJoin = Rectangle.Union(m_rectColStartJoin, rctDest);
            }
        }
Пример #5
0
 public override void OnMouseDownNonStandard(object sender, MouseEventArgs e)
 {
     m_objetStartJoin = null;
     if (
         (ModeSourisCustom == EModeSourisCustom.LienWorkflow) &&
         e.Button == MouseButtons.Left)
     {
         Point ptLogique = GetLogicalPointFromDisplay(new Point(e.X, e.Y));
         m_objetStartJoin = ObjetEdite.SelectionnerElementDuDessus(ptLogique) as CWorkflowEtapeDessin;
         if (m_objetStartJoin != null)
         {
             Rectangle rctStart = m_objetStartJoin.RectangleAbsolu;
             rctStart = new Rectangle(GetDisplayPointFromLogical(rctStart.Location),
                                      GetDisplaySizeFromLogical(rctStart.Size));
             m_rectStartLien = rctStart;
             m_rectLien      = m_rectStartLien;
         }
     }
 }
Пример #6
0
 //------------------------------------------------------------------------------
 protected override void DragOverTraitement(DragEventArgs e)
 {
     if (e.Data.GetDataPresent(typeof(CReferenceObjetDonnee)))
     {
         CReferenceObjetDonnee reference = e.Data.GetData(typeof(CReferenceObjetDonnee)) as CReferenceObjetDonnee;
         if (reference.TypeObjet == typeof(CModeleAffectationUtilisateurs))
         {
             Point pt        = PointToClient(new Point(e.X, e.Y));
             Point ptLogique = GetLogicalPointFromDisplay(pt);
             CWorkflowEtapeDessin dessinEtape = ObjetEdite.SelectionnerElementDuDessus(ptLogique) as CWorkflowEtapeDessin;
             if (dessinEtape != null)
             {
                 e.Effect = DragDropEffects.Link;
                 return;
             }
         }
     }
     base.DragOverTraitement(e);
 }
Пример #7
0
 public override void OnMouseDownNonStandard(object sender, MouseEventArgs e)
 {
     m_colStartJoin = null;
     if (ModeSourisCustom == EModeSourisCustom.Join && e.Button == MouseButtons.Left)
     {
         Point ptLogique = GetLogicalPointFromDisplay(new Point(e.X, e.Y));
         m_table1Join = ObjetEdite.SelectionnerElementDuDessus(ptLogique) as CODEQBase;
         if (m_table1Join != null)
         {
             m_colStartJoin = m_table1Join.GetColonneAt(ptLogique);
             if (m_colStartJoin != null)
             {
                 Rectangle rctCol = m_table1Join.GetRectAbsoluColonne(m_colStartJoin);
                 rctCol = new Rectangle(GetDisplayPointFromLogical(rctCol.Location),
                                        GetDisplaySizeFromLogical(rctCol.Size));
                 m_rectColStartJoin = rctCol;
                 m_rectJoin         = m_rectColStartJoin;
             }
         }
     }
 }
Пример #8
0
        /// //////////////////////////////////////////////////
        protected override void Editeur_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
        {
            if (ObjetEdite == null)
            {
                return;
            }
            if (LockEdition)
            {
                return;
            }

            if (e.Data.GetDataPresent(typeof(CReferenceObjetDonnee)))
            {
                CReferenceObjetDonnee reference = e.Data.GetData(typeof(CReferenceObjetDonnee)) as CReferenceObjetDonnee;
                if (reference.TypeObjet == typeof(CModeleAffectationUtilisateurs))
                {
                    Point pt        = PointToClient(new Point(e.X, e.Y));
                    Point ptLogique = GetLogicalPointFromDisplay(pt);
                    CWorkflowEtapeDessin dessinEtape = ObjetEdite.SelectionnerElementDuDessus(ptLogique) as CWorkflowEtapeDessin;
                    if (dessinEtape != null)
                    {
                        CModeleAffectationUtilisateurs modele = reference.GetObjet(CSc2iWin32DataClient.ContexteCourant) as CModeleAffectationUtilisateurs;
                        if (modele != null)
                        {
                            CParametresAffectationEtape parametres = modele.ParametresAffectation;
                            if (parametres != null)
                            {
                                CParametresInitialisationEtape parametre = dessinEtape.Initializations;
                                CParametresAffectationEtape    parAff    = parametre.Affectations;
                                if (parAff != null)
                                {
                                    if (MessageBox.Show(I.T("Replace current assignments(Yes) or add new assignemnts(No) ?|20135"), "",
                                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                    {
                                        parAff = new CParametresAffectationEtape();
                                    }
                                    parAff.AddFormules(parametres.Formules);
                                    parametre.Affectations      = parAff;
                                    dessinEtape.Initializations = parametre;
                                    e.Effect = DragDropEffects.Link;
                                    Refresh();
                                    return;
                                }
                            }
                        }
                    }
                }
            }

            List <CDonneeDragDropObjetGraphique> datas = GetDragDropData(e.Data);

            if (datas == null || datas.Count == 0)
            {
                return;
            }

            List <I2iObjetGraphique> candidats = new List <I2iObjetGraphique>();

            foreach (CRectangleDragForObjetGraphique rct in RectsDrags)
            {
                candidats.Add(rct.ObjetGraphique);
            }

            Point             ptLocal = GetLogicalPointFromDisplay(PointToClient(new Point(e.X, e.Y)));
            I2iObjetGraphique parent  = ObjetEdite.SelectionnerElementConteneurDuDessus(ptLocal, candidats);

            parent = DessinWorkflow;;
            if (parent == null)
            {
                e.Effect = DragDropEffects.None;
            }
            else
            {
                List <I2iObjetGraphique> nouveaux = new List <I2iObjetGraphique>();
                foreach (CRectangleDragForObjetGraphique rct in RectsDrags)
                {
                    rct.RectangleDrag = rct.Datas.GetDragDropPosition(ptLocal);
                    rct.RectangleDrag = GetRectangleSelonModesActives(rct.RectangleDrag, ptLocal);
                    // rct.RectangleDrag.Offset((int)(AutoScrollPosition.X / Echelle), (int)(AutoScrollPosition.Y / Echelle));

                    //Si dummy de création (type de bloc), création d'une nouvelle étape
                    I2iObjetGraphique objetGraphique = rct.Datas.ObjetDragDrop;
                    CDummyObjetWorkflowPourCreation dummyCreation = objetGraphique as CDummyObjetWorkflowPourCreation;
                    if (dummyCreation != null)
                    {
                        CTypeEtapeWorkflow typeEtape = dummyCreation.TypeEtape;
                        if (typeEtape == null)
                        {
                            typeEtape = new CTypeEtapeWorkflow(DessinWorkflow.TypeWorkflow.ContexteDonnee);
                            typeEtape.CreateNewInCurrentContexte();
                            typeEtape.Workflow = DessinWorkflow.TypeWorkflow;
                            typeEtape.Bloc     = Activator.CreateInstance(dummyCreation.TypeBloc, new object[] { typeEtape }) as CBlocWorkflow;
                        }
                        CWorkflowEtapeDessin graphEtape = new CWorkflowEtapeDessin();
                        graphEtape.TypeEtape = typeEtape;
                        objetGraphique       = graphEtape;
                        objetGraphique.Size  = dummyCreation.Size;
                    }

                    JusteBeforePositionneSurApresDragDrop(objetGraphique);
                    bool bParentIsInSelec = objetGraphique.Parent != null && candidats.Contains(objetGraphique.Parent);

                    bool bHasMove = false;

                    if (e.Effect == DragDropEffects.Copy)
                    {
                        Dictionary <Type, object> dicObjetsPourCloner = new Dictionary <Type, object>();
                        AddObjectsForClonerSerializer(dicObjetsPourCloner);
                        objetGraphique = (I2iObjetGraphique)objetGraphique.GetCloneAMettreDansParent(parent, dicObjetsPourCloner);

                        if (objetGraphique == null || !parent.AddChild(objetGraphique))
                        {
                            e.Effect = DragDropEffects.None;
                            objetGraphique.CancelClone();
                            continue;
                        }
                        else
                        {
                            objetGraphique.Parent = parent;
                            nouveaux.Add(objetGraphique);
                        }
                        bHasMove = true;
                    }
                    else
                    {
                        bHasMove = true;
                        if (objetGraphique.Parent != parent)
                        {
                            if (objetGraphique.Parent != null)
                            {
                                if (!bParentIsInSelec)
                                {
                                    objetGraphique.Parent.RemoveChild(objetGraphique);
                                }
                            }
                            else
                            {
                                nouveaux.Add(objetGraphique);
                            }
                            if (!bParentIsInSelec)
                            {
                                if (!parent.AddChild(objetGraphique))
                                {
                                    e.Effect = DragDropEffects.None;
                                    continue;
                                }
                                else
                                {
                                    objetGraphique.Parent = parent;
                                }
                            }
                        }
                    }


                    if (!bParentIsInSelec && bHasMove)
                    {
                        Point ptDrop = new Point(rct.RectangleDrag.Left, rct.RectangleDrag.Top);
                        objetGraphique.PositionAbsolue = ptDrop;
                    }
                }
                if (nouveaux.Count > 0)
                {
                    RefreshSelectionChanged = false;
                    Selection.Clear();
                    Selection.AddRange(nouveaux);
                    RefreshSelectionChanged = true;
                    DeclencheAfterAddElements(nouveaux);
                    Refresh();
                }
            }


            ElementModifie();
            EnDeplacement = false;
            Dessiner(true, true);
        }
Пример #9
0
 //-----------------------------------------------------------------
 public override void OnMouseUpNonStandard(object sender, MouseEventArgs e)
 {
     if ((ModeSourisCustom == EModeSourisCustom.LienSequence || ModeSourisCustom == EModeSourisCustom.LienParametre) && e.Button == MouseButtons.Left)
     {
         Point ptLogique = GetLogicalPointFromDisplay(new Point(e.X, e.Y));
         CRepresentationExpressionGraphique dest = ObjetEdite.SelectionnerElementDuDessus(ptLogique) as CRepresentationExpressionGraphique;
         if (dest != null && dest != m_expressionStartJoin)
         {
             if (dest != null)
             {
                 bool bTraite = false;
                 if (ModeSourisCustom == EModeSourisCustom.LienSequence)
                 {
                     foreach (ToolStripMenuItem item in new ArrayList(m_menuSortieSequence.Items))
                     {
                         if (item != m_menuNext)
                         {
                             m_menuSortieSequence.Items.Remove(item);
                             item.Dispose();
                         }
                     }
                     C2iExpressionAnalysable expAn = m_expressionStartJoin.Formule as C2iExpressionAnalysable;
                     if (expAn != null)
                     {
                         CInfo2iExpression info = expAn.GetInfos();
                         if (info.InfosParametres.Count() == 1)
                         {
                             CInfo2iDefinitionParametres defs = info.InfosParametres[0];
                             int nNum = 0;
                             foreach (CInfoUnParametreExpression par in defs.InfosParametres)
                             {
                                 if (par.IsSortieSequence)
                                 {
                                     CMenuNumero menu = new CMenuNumero(par.NomParametre, nNum);
                                     m_menuSortieSequence.Items.Add(menu);
                                     menu.Click += new EventHandler(menu_Click);
                                     if (ModifierKeys == Keys.Control)
                                     {
                                         if (m_expressionStartJoin.GetExterne(nNum) == dest)
                                         {
                                             m_expressionStartJoin.SetExterne(nNum, null);
                                             bTraite = true;
                                         }
                                     }
                                 }
                                 nNum++;
                             }
                         }
                     }
                     if (!bTraite)
                     {
                         if (ModifierKeys == Keys.Control)
                         {
                             m_expressionStartJoin.Next = null;
                         }
                         else
                         {
                             if (m_menuSortieSequence.Items.Count != 1)
                             {
                                 ShowInterfaceLienAction(m_expressionStartJoin, dest);
                             }
                             else
                             {
                                 m_expressionStartJoin.Next = dest;
                             }
                         }
                     }
                 }
                 else if (ModeSourisCustom == EModeSourisCustom.LienParametre)
                 {
                     if (ModifierKeys == Keys.Control)
                     {
                         dest.StopUseExterne(m_expressionStartJoin);
                     }
                     else
                     {
                         ShowInterfaceLienParametre(m_expressionStartJoin, dest);
                     }
                 }
             }
         }
         m_expressionStartJoin = null;
         OnChangeFormules();
     }
 }