Example #1
0
        private bool CPanelEditionSymbole_AfterAddElements(List <I2iObjetGraphique> nouveaux)
        {
            if (ModeEdition != EModeEditeurSymbole.Selection)
            {
                m_editeur.SetBoutonSelection(true);
                ModeEdition = EModeEditeurSymbole.Selection;
                if (m_ligneEditee != null)
                {
                    m_ligneEditee.SetModeSelection(true);
                }
            }
            foreach (I2iObjetGraphique obj in nouveaux)
            {
                if (typeof(C2iSymbole).IsAssignableFrom(obj.GetType()))
                {
                    m_ligneEditee = obj as C2iSymboleLigne;

                    /*      if (m_ligneEditee != null)
                     *    {
                     *        ModeEdition = EModeEditeurSymbole.EditionLigne;
                     *
                     *        m_ligneEditee.SetModeSelection(false);
                     *
                     *    }*/
                }
            }

            return(true);
        }
Example #2
0
/*
 *
 *      private void CPanelEditionSymbole_MouseUp(object sender, MouseEventArgs e)
 *      {
 *          Point mousePoint = GetMouseLogicalPoint(new Point(e.X, e.Y));
 *          Refresh();
 *          if (this.ObjetEdite != null)
 *          {
 *              if (ModeEdition == EModeEditeurSymbole.Selection)
 *              {
 *                  Refresh();
 *              }
 *
 *              if (ModeEdition == EModeEditeurSymbole.EditionModificationPoint && m_ligneEditee != null && m_SelectedPoint != null)
 *              {
 *                  m_ligneEditee.ReplacePoint((Point)m_SelectedPoint, mousePoint);
 *                  // m_SelectedPoint = null;
 *                  // m_ligneEditee.UnSelectPoint();
 *                  Refresh();
 *                  ModeEdition = EModeEditeurSymbole.EditionLigne;
 *
 *              }
 *              if (ModeEdition == EModeEditeurSymbole.EditionLigne && m_ligneEditee != null)
 *              {
 *
 *                  m_ligneEditee.SetModeSelection(false);
 *                  Point pt = mousePoint;
 *
 *                  if ((ModifierKeys & Keys.Control) == Keys.Control)
 *                  {
 *                      Point? prevPointOnLine;
 *                      if ((prevPointOnLine = m_ligneEditee.PointOnlineAfterPoint(pt)) != null)
 *                      {
 *                          //if (CFormAlerte.Afficher("Do you want to add a new point on the line", EFormAlerteType.Question) == DialogResult.Yes)
 *                          if (MessageBox.Show(I.T("Do you want to add a new point on the line ?|30032"), "", MessageBoxButtons.YesNo) == DialogResult.Yes)
 *                              m_ligneEditee.InsertAfterPoint((Point)prevPointOnLine, pt);
 *
 *                      }
 *                      else
 *                          m_ligneEditee.AddPoint(pt);
 *
 *                  }
 *                  else
 *                  {
 *
 *                      m_SelectedPoint = m_ligneEditee.SelectPoint(mousePoint);
 *
 *                      if (((ModifierKeys & Keys.Shift) == Keys.Shift) && (m_SelectedPoint != null))
 *                      {
 *                          if (m_ligneEditee.RemovePoint((Point)m_SelectedPoint))
 *                          {
 *                              m_SelectedPoint = null;
 *                              m_ligneEditee.UnSelectPoint();
 *                              Refresh();
 *                          }
 *                          else
 *                              MessageBox.Show(I.T("Impossible to remove the point|30033"));
 *                      }
 *
 *                  }
 *
 *                  Refresh();
 *
 *              }
 *
 *          }
 *      }
 */


        public void EditeLine(C2iSymboleLigne ligne)
        {
            Selection.Clear();
            Selection.Add(ligne);
            ModeEdition   = EModeEditeurSymbole.EditionLigne;
            m_ligneEditee = ligne;
            m_ligneEditee.SetModeSelection(false);
            Refresh();
        }
Example #3
0
        private void CPanelEditionSymbole_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Escape || e.KeyData == Keys.Delete)
            {
                if (ModeEdition != EModeEditeurSymbole.Selection)
                {
                    ModeEdition = EModeEditeurSymbole.Selection;
                    if (m_ligneEditee != null)
                    {
                        m_ligneEditee.SetModeSelection(true);
                        m_ligneEditee = null;
                    }
                }
            }


            Refresh();
        }
Example #4
0
        private void CPanelEditionSymbole_DoubleClick(object sender, EventArgs e)
        {
            if ((!LockEdition))// && (ObjetEdite != null))
            {
                if (ModeEdition == EModeEditeurSymbole.Selection)
                {
                    if (Selection.Count == 1)
                    {
                        m_ligneEditee = Selection[0] as C2iSymboleLigne;
                        if (m_ligneEditee != null)
                        {
                            this.ModeEdition = EModeEditeurSymbole.EditionLigne;

                            m_ligneEditee.SetModeSelection(false);
                        }
                    }
                }
            }
        }
Example #5
0
        public override void OnMouseUpNonStandard(object sender, MouseEventArgs e)
        {
            Point ptSouris = GetLogicalPointFromDisplay(new Point(e.X, e.Y));

            ptSouris = m_ligneEditee.Parent.GlobalToClient(ptSouris);

            if (ModeEdition == EModeEditeurSymbole.EditionModificationPoint && m_ligneEditee != null && m_nIndexSelectedPoint >= 0)
            {
                if ((ModifierKeys & Keys.Shift) == Keys.Shift)
                {
                    ptSouris = new Point(GetThePlusProche(ptSouris.X, EDimentionDessin.X),
                                         GetThePlusProche(ptSouris.Y, EDimentionDessin.Y));
                }

                m_ligneEditee.ReplacePoint(m_nIndexSelectedPoint, ptSouris);

                Refresh();
                ModeEdition = EModeEditeurSymbole.EditionLigne;
            }
            else if (ModeEdition == EModeEditeurSymbole.EditionLigne && m_ligneEditee != null)
            {
                if (e.Button == MouseButtons.Right)
                {
                    ModeEdition = EModeEditeurSymbole.Selection;

                    if (m_ligneEditee != null)
                    {
                        m_ligneEditee.SetModeSelection(true);
                        m_ligneEditee = null;
                    }
                    Refresh();
                }
                else
                {
                    m_ligneEditee.SetModeSelection(false);

                    if ((ModifierKeys & Keys.Control) == Keys.Control)
                    {
                        // On ajoute un point
                        Point pt = ptSouris;
                        Point?prevPointOnLine;
                        if ((prevPointOnLine = m_ligneEditee.PointOnlineBeforePoint(pt)) != null)
                        {
                            m_ligneEditee.InsertAfterPoint((Point)prevPointOnLine, pt);
                            Refresh();
                        }
                        else
                        {
                            m_ligneEditee.InsertAfterLastPoint(pt);
                        }
                    }
                    else
                    {
                        m_nIndexSelectedPoint = m_ligneEditee.GetIndexPointProche(ptSouris);

                        if (((ModifierKeys & Keys.Shift) == Keys.Shift) && (m_nIndexSelectedPoint >= 0))
                        {
                            // On supprime un point
                            if (m_ligneEditee.RemovePoint(m_nIndexSelectedPoint))
                            {
                                m_nIndexSelectedPoint = -1;
                                Refresh();
                            }
                            else
                            {
                                MessageBox.Show(I.T("Impossible to remove the point|30033"));
                            }
                        }
                    }
                }
            }
        }