Пример #1
0
        public bool PreFilterMessage(ref Message m)
        {
            // Exit out early if we're not dragging any content
            if (!_isDragging)
            {
                return(false);
            }

            // We only care about mouse events
            if (!(m.Msg == (int)WM.MOUSEMOVE ||
                  m.Msg == (int)WM.LBUTTONDOWN || m.Msg == (int)WM.LBUTTONUP || m.Msg == (int)WM.LBUTTONDBLCLK ||
                  m.Msg == (int)WM.RBUTTONDOWN || m.Msg == (int)WM.RBUTTONUP || m.Msg == (int)WM.RBUTTONDBLCLK))
            {
                return(false);
            }

            // Move content
            if (m.Msg == (int)WM.MOUSEMOVE)
            {
                HandleDrag();
                return(false);
            }

            // Drop content
            if (m.Msg == (int)WM.LBUTTONUP)
            {
                if (_targetRegion != null)
                {
                    _dockPanel.RemoveContent(_dragContent);
                    _dragContent.DockArea = _targetRegion.DockArea;
                    _dockPanel.AddContent(_dragContent);
                }
                else if (_targetGroup != null)
                {
                    _dockPanel.RemoveContent(_dragContent);

                    switch (_insertType)
                    {
                    case DockInsertType.None:
                        _dockPanel.AddContent(_dragContent, _targetGroup);
                        break;

                    case DockInsertType.Before:
                    case DockInsertType.After:
                        _dockPanel.InsertContent(_dragContent, _targetGroup, _insertType);
                        break;
                    }
                }

                StopDrag();
                return(false);
            }

            return(true);
        }
Пример #2
0
        public void CloseDocument(bool mod, RefFilename path)
        {
            var textEditors       = !mod ? baseTextEditors : modTextEditors;
            var openScriptWindows = !mod ? openBaseScriptWindows : openModScriptWindows;

            if (openScriptWindows.ContainsKey(path))
            {
                DockPanel.RemoveContent(openScriptWindows[path]);
            }
        }