Esempio n. 1
0
 private void tabControl_SelectedIndexChanged(object sender, EventArgs e)
 {
     currentTab = (EditorTab)tabControl.SelectedTab;
     try
     {
         CurrentEditor.Focus();
     }
     catch { }; //TODO: КОСТЫЛЬ!!!
 }
Esempio n. 2
0
 public override void Abort()
 {
     _preferredPlacements = null;
     CurrentEditor.ReleaseMouseCapture();
     CurrentEditor.Focus();
     CurrentAdorner = null;
     Target         = null;
     MouseIsDown    = false;
     IsDrawing      = false;
     CurrentStatus  = DefaultStatusText;
 }
Esempio n. 3
0
        private void ClearTemporaries()
        {
            if (_adorner != null)
            {
                RemoveAdorner(ref _adorner);
            }

            _currentAtomVisual = null;
            IsDrawing          = false;
            //clear this to prevent a weird bug in drawing
            CurrentEditor.ActiveChemistry = null;
            CurrentEditor.Focus();
        }
Esempio n. 4
0
 private void CurrentEditor_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (MouseIsDown)
     {
         if (_preferredPlacements != null)
         {
             List <NewAtomPlacement> newAtomPlacements = new List <NewAtomPlacement>();
             FillExistingAtoms(_preferredPlacements, newAtomPlacements, CurrentEditor);
             EditViewModel.DrawRing(newAtomPlacements, false);
         }
     }
     CurrentEditor.ReleaseMouseCapture();
     CurrentEditor.Focus();
     CurrentAdorner = null;
     Target         = null;
     MouseIsDown    = false;
     IsDrawing      = false;
     CurrentStatus  = DefaultStatusText;
 }
Esempio n. 5
0
        private void CurrentEditor_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            dynamic currentObject = CurrentObject(e);

            if (IsDragging)
            {
                if (_atomList != null && _atomList.Any())
                {
                    EditViewModel.DoTransform(_shift, _atomList);
                    _atomList[0].Parent.UpdateVisual();
                }

                IsDragging = false;
                if (_ghostAdorner != null)
                {
                    RemoveAdorner(_ghostAdorner);
                    _ghostAdorner = null;
                }

                _atomList = null;
            }
            else
            {
                //did we go up on the target we went down on?
                if ((currentObject != null) & (currentObject == _initialTarget))
                {
                    //select it
                    DoSelectionClick(e);
                }
                else if (_initialTarget != null && EditViewModel.SelectedItems.Contains(_initialTarget))
                {
                    DoSelectionClick(e);
                }

                if (_lassoAdorner != null)
                {
                    _lassoHits = new List <object>();
                    GatherSelection(_lassoAdorner.Outline);
                    _lassoHits = _lassoHits.Distinct().ToList();
                    EditViewModel.AddToSelection(_lassoHits);
                }
                if (EditViewModel.SelectedItems.Any())
                {
                    CurrentStatus = ActiveSelText;
                }

                if (_lassoAdorner != null)
                {
                    DisposeLasso();
                }
            }

            _initialTarget = null;
            _mouseTrack    = null;

            CurrentEditor.ReleaseMouseCapture();

            CurrentEditor.Focus();
            var al = AdornerLayer.GetAdornerLayer(CurrentEditor);

            al.Update();
            CurrentStatus = DefaultText;
        }