コード例 #1
0
        public override bool OnMouseDown(MouseEventArgs e, KeyModifier eKeyMod, int iOldX, int iOldY)
        {
            // 1. 현재 마우스 포지션의 UI 를 가지고 온다
            // 2. UI 가 있고, 커서가 경계에 겹칠 경우 - Select 해주고 마우스 커서 변경 , Move Mode 로 Position 변경
            // 3. UI 가 있고, 커서가 경계 안에 있을 경우 - 사이즈 변경


            if (e.Button == MouseButtons.Left)
            {
                UIShapeBase selectedShape = null;
                if (View.Cursor == Cursors.Arrow)  // 화살표일 경우 선택 모드
                {
                    m_selectedShapeList.Clear();
                    selectedShape = this.GetUIShape(e.X, e.Y, false);
                }
                else if (View.Cursor == Cursors.Cross)
                {
                    selectedShape = this.GetUIShape(e.X, e.Y, false);
                }
                else// 화살표가 아니면 선택된 아이템중에 선택
                {
                    selectedShape = this.GetUIShapeFromSelection(e.X, e.Y);
                }


                if (eKeyMod == KeyModifier.Shift) // Shift 누르면 복사
                {
                    m_bCopying = true;
                    Dragmode   = MOUSE_MODE.UI_COPY;
                }

                if (selectedShape != null)
                {
                    if (m_selectedShapeList.Contains(selectedShape) == false)
                    {
                        m_selectedShapeList.Add(selectedShape);
                    }
                }
            }

//             if (EditorManager.SelectedShapes.Contains(m_selectedShape) == false )
//             {
//                 EditorManager.SelectedShapes = new CSharpFramework.ShapeCollection();
//                 EditorManager.SelectedShapes.Add(m_selectedShape);
//             }

            if (m_selectedShapeList.Count >= 1)
            {
                if (View.Cursor == Cursors.SizeAll)
                {
                    if (eKeyMod == KeyModifier.Shift && Dragmode == MOUSE_MODE.UI_COPY) // 시프트키 눌리고 , 셀렉티드 쉐입에 , Move Mode 이면 복사
                    {
                        m_bCopying = true;

                        foreach (UIShapeBase shape in m_selectedShapeList)
                        {
                            if (shape != null)
                            {
                                UIShapeBase copyShape = CreateNewShape(shape, m_baseDialog, shape.PosX, shape.PosY);
                                m_UICopyShapeList.Add(copyShape);
                            }
                        }

                        m_selectedShapeList.Clear();

                        m_selectedShapeList.AddRange(m_UICopyShapeList);
                        m_UIShapeList.AddRange(m_UICopyShapeList);

//
//                         foreach (UIShapeBase shape in m_UICopyShapeList)
//                         {
//                             EditorManager.Actions.Add(new AddShapeAction(shape, m_baseDialog, shape.ParentLayer, true));
//                         }

//
//                         EditorManager.SelectedShapes.Clear(); // 기존 선택된 UI 들 지우고
//                         EditorManager.SelectedShapes.AddRange(m_UICopyShapeList); // 복사된거만 선택


                        m_bCopying = false;

                        //UIShapeBase copyShape = CreateNewShape(m_selectedShape, m_baseDialog, m_selectedShape.PosX, m_selectedShape.PosY);

                        //m_selectedShape = copyShape;
                        //UIShapeBase copyShape = (UIShapeBase)m_selectedShape.Clone();

                        //m_UICopyShapeList.Add(copyShape);
                    }
                    else
                    {
                        Dragmode = MOUSE_MODE.UI_MOVE;
                    }
                }
                else if (View.Cursor == Cursors.Arrow)
                {
                }
                else
                {
                    Dragmode = MOUSE_MODE.UI_SIZE;
                }
            }

            if (Dragmode == MOUSE_MODE.UI_COPY)
            {
                ShapeCollection collection = new CSharpFramework.ShapeCollection();
                collection.AddRange(m_UICopyShapeList);

                EditorManager.SelectedShapes = collection;
            }
            else
            {
                ShapeCollection collection = new CSharpFramework.ShapeCollection();
                collection.AddRange(m_selectedShapeList);

                EditorManager.SelectedShapes = collection;
            }

            return(false);
        }
コード例 #2
0
        public override bool OnMouseDown(MouseEventArgs e, KeyModifier eKeyMod, int iOldX, int iOldY)
        {
            // 1. 현재 마우스 포지션의 UI 를 가지고 온다
            // 2. UI 가 있고, 커서가 경계에 겹칠 경우 - Select 해주고 마우스 커서 변경 , Move Mode 로 Position 변경
            // 3. UI 가 있고, 커서가 경계 안에 있을 경우 - 사이즈 변경

            if (e.Button == MouseButtons.Left)
            {
                UIShapeBase selectedShape = null;
                if (View.Cursor == Cursors.Arrow ) // 화살표일 경우 선택 모드
                {
                    m_selectedShapeList.Clear();
                    selectedShape = this.GetUIShape(e.X, e.Y, false);
                }
                else if ( View.Cursor == Cursors.Cross )
                {
                    selectedShape = this.GetUIShape(e.X, e.Y, false);
                }
                else// 화살표가 아니면 선택된 아이템중에 선택
                {
                    selectedShape = this.GetUIShapeFromSelection(e.X, e.Y);
                }

                if (eKeyMod == KeyModifier.Shift) // Shift 누르면 복사
                {
                    m_bCopying = true;
                    Dragmode = MOUSE_MODE.UI_COPY;
                }

                if (selectedShape != null)
                {
                    if (m_selectedShapeList.Contains(selectedShape ) == false )
                        m_selectedShapeList.Add(selectedShape);
                }

            }

            //             if (EditorManager.SelectedShapes.Contains(m_selectedShape) == false )
            //             {
            //                 EditorManager.SelectedShapes = new CSharpFramework.ShapeCollection();
            //                 EditorManager.SelectedShapes.Add(m_selectedShape);
            //             }

            if (m_selectedShapeList.Count >= 1 )
            {
                if (View.Cursor == Cursors.SizeAll)
                {
                    if (eKeyMod == KeyModifier.Shift && Dragmode == MOUSE_MODE.UI_COPY) // 시프트키 눌리고 , 셀렉티드 쉐입에 , Move Mode 이면 복사
                    {
                        m_bCopying = true;

                        foreach (UIShapeBase shape in m_selectedShapeList )
                        {
                            if (shape != null)
                            {
                                UIShapeBase copyShape = CreateNewShape(shape, m_baseDialog, shape.PosX, shape.PosY);
                                m_UICopyShapeList.Add(copyShape);
                            }
                        }

                        m_selectedShapeList.Clear();

                        m_selectedShapeList.AddRange(m_UICopyShapeList);
                        m_UIShapeList.AddRange(m_UICopyShapeList);

            //
            //                         foreach (UIShapeBase shape in m_UICopyShapeList)
            //                         {
            //                             EditorManager.Actions.Add(new AddShapeAction(shape, m_baseDialog, shape.ParentLayer, true));
            //                         }

            //
            //                         EditorManager.SelectedShapes.Clear(); // 기존 선택된 UI 들 지우고
            //                         EditorManager.SelectedShapes.AddRange(m_UICopyShapeList); // 복사된거만 선택

                        m_bCopying = false;

                        //UIShapeBase copyShape = CreateNewShape(m_selectedShape, m_baseDialog, m_selectedShape.PosX, m_selectedShape.PosY);

                        //m_selectedShape = copyShape;
                        //UIShapeBase copyShape = (UIShapeBase)m_selectedShape.Clone();

                        //m_UICopyShapeList.Add(copyShape);
                    }
                    else
                    {
                        Dragmode = MOUSE_MODE.UI_MOVE;
                    }
                }
                else if ( View.Cursor ==  Cursors.Arrow )
                {

                }
                else
                {
                    Dragmode = MOUSE_MODE.UI_SIZE;
                }
            }

            if (Dragmode == MOUSE_MODE.UI_COPY)
            {
                ShapeCollection collection = new CSharpFramework.ShapeCollection();
                collection.AddRange(m_UICopyShapeList);

                EditorManager.SelectedShapes = collection;
            }
            else
            {
                ShapeCollection collection = new CSharpFramework.ShapeCollection();
                collection.AddRange(m_selectedShapeList);

                EditorManager.SelectedShapes = collection;
            }

            return false;
        }