예제 #1
0
 private void OnLaunchPreview(PreviewEventArgs args)
 {
     if (LaunchPreview != null)
     {
         LaunchPreview(this, args);
     }
 }
예제 #2
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            UpdateCursor();

            // If user left clicks and item and it is the item that was previously selected
            // (oldSelection), the UI will be alerted to bring it up the structure selector
            Editroid.ROM.ObjectInstance oldSelection = null;
            if (_focus != null)
            {
                oldSelection = _focus.SelectedItem;
            }

            if ((ModifierKeys & Keys.Control) == Keys.Control)
            {
                ScreenEditor clicked = screens.GetEditorAtWorld(e.X + viewX, e.Y + viewY);
                if (clicked != _focus)
                {
                    RequestFocus(clicked);
                }

                PreviewEventArgs args = new PreviewEventArgs(
                    (ModifierKeys & Keys.Shift) == Keys.Shift,
                    new Point(e.X + viewX - _focus.WorldBounds.X, e.Y + viewY - _focus.WorldBounds.Y));

                OnLaunchPreview(args);
            }
            else
            {
                // Mouse dragging occurs with middle button, or while holding shift and/or alt
                if (e.Button == MouseButtons.Middle || UserHoldingMouseScrollKey)
                {
                    BeginDrag(e.X, e.Y);
                }
                else
                {
                    screens.SendMouseDown(e.Button, e.X + viewX, e.Y + viewY);

                    if (e.Button == MouseButtons.Left)
                    {
                        // Scroll structure selector to selected structure type if user clicks twice
                        Editroid.ROM.ObjectInstance newSelection = null;
                        if (_focus != null)
                        {
                            newSelection = _focus.SelectedItem;
                        }
                        if (newSelection != null && newSelection == oldSelection)
                        {
                            RequestShowObject.Raise(this);
                        }
                    }
                }
            }
        }