Beispiel #1
0
 private void InitializeViewMenuEvents()
 {
     ViewProjectDiagrams.Click         += (sender, e) => ShowProjectDiagrams();
     ViewSolutionDiagrams.Click        += (sender, e) => ShowSolutionDiagrams();
     ViewDiagram.Click                 += (sender, e) => ShowDiagram();
     ViewDiagramSelectedElements.Click += (sender, e) => ShowDiagramSelectedElements();
     ViewDiagramHistory.Click          += (sender, e) => ShowDiagramHistory();
     ViewPreviousDiagramProject.Click  += (sender, e) => TreeEditor.SelectPreviousItem(Editor.Context.CurrentTree, false);
     ViewNextDiagramProjcet.Click      += (sender, e) => TreeEditor.SelectNextItem(Editor.Context.CurrentTree, false);
     ViewPreviousDiagramSolution.Click += (sender, e) => TreeEditor.SelectPreviousItem(Editor.Context.CurrentTree, true);
     ViewNextDiagramSolution.Click     += (sender, e) => TreeEditor.SelectNextItem(Editor.Context.CurrentTree, true);
 }
Beispiel #2
0
        private void HandleKeyEvents(KeyEventArgs e)
        {
            var  canvas    = Editor.Context.CurrentCanvas;
            bool isControl = Keyboard.Modifiers == ModifierKeys.Control;
            bool canMove   = e.OriginalSource is DiagramControl;
            var  key       = e.Key;

            if (isControl == true)
            {
                switch (key)
                {
                case Key.O: OpenSolution(); break;

                case Key.S: SaveSolutionAsDlg(false); break;

                case Key.N: NewSolution(); break;

                case Key.T: OpenTags(); break;

                case Key.I: ImportTags(); break;

                case Key.R: Editor.ResetThumbTags(); break;

                case Key.E: ExportDxf(); break;

                case Key.P: Print(); break;

                case Key.Z: Editor.Undo(); break;

                case Key.Y: Editor.Redo(); break;

                case Key.X: Editor.Cut(); break;

                case Key.C: Editor.Copy(); break;

                case Key.V: Editor.Paste(new PointEx(0.0, 0.0), true); break;

                case Key.A: Editor.SelectAll(); break;

                case Key.OemOpenBrackets: Editor.SelectPrevious(false); break;

                case Key.OemCloseBrackets: Editor.SelectNext(false); break;

                case Key.J: Editor.CreateAndPaste(); break;

                case Key.M: Editor.Create(); break;

                case Key.OemComma: TreeEditor.SelectPreviousItem(Editor.Context.CurrentTree, true); break;

                case Key.OemPeriod: TreeEditor.SelectNextItem(Editor.Context.CurrentTree, true); break;

                case Key.H: ShowDiagramHistory(); break;
                }
            }
            else
            {
                switch (key)
                {
                case Key.OemOpenBrackets: Editor.SelectPrevious(true); break;

                case Key.OemCloseBrackets: Editor.SelectNext(true); break;

                case Key.OemPipe: Editor.SelectConnected(); break;

                case Key.Escape: DeselectAll(); break;

                case Key.Delete: Delete(); break;

                case Key.Up: if (canMove == true)
                    {
                        MoveUp(); e.Handled = true;
                    }
                    break;

                case Key.Down: if (canMove == true)
                    {
                        MoveDown(); e.Handled = true;
                    }
                    break;

                case Key.Left: if (canMove == true)
                    {
                        MoveLeft(); e.Handled = true;
                    }
                    break;

                case Key.Right: if (canMove == true)
                    {
                        MoveRight(); e.Handled = true;
                    }
                    break;

                case Key.I: InsertInput(canvas, GetInsertionPoint()); break;

                case Key.O: InsertOutput(canvas, GetInsertionPoint()); break;

                case Key.R: InsertOrGate(canvas, GetInsertionPoint()); break;

                case Key.A: InsertAndGate(canvas, GetInsertionPoint()); break;

                case Key.S: Editor.ToggleWireStart(); break;

                case Key.E: Editor.ToggleWireEnd(); break;

                case Key.C: Connect(); break;

                case Key.OemComma: TreeEditor.SelectPreviousItem(Editor.Context.CurrentTree, false); break;

                case Key.OemPeriod: TreeEditor.SelectNextItem(Editor.Context.CurrentTree, false); break;

                case Key.F5: TabExplorer.IsSelected = true; break;

                case Key.F6: TabTags.IsSelected = true; InitializeTagEditor(); break;

                case Key.F7: TabTables.IsSelected = true; InitializeTableEditor(); break;

                case Key.F8: TabModel.IsSelected = true; break;

                case Key.F9: TabOptions.IsSelected = true; break;
                }
            }
        }