//autofac uses this
        public EditingView(EditingModel model, PageListView pageListView,
			CutCommand cutCommand, CopyCommand copyCommand, PasteCommand pasteCommand, UndoCommand undoCommand,
			DuplicatePageCommand duplicatePageCommand,
			DeletePageCommand deletePageCommand, NavigationIsolator isolator, ControlKeyEvent controlKeyEvent)
        {
            _model = model;
            _pageListView = pageListView;
            _cutCommand = cutCommand;
            _copyCommand = copyCommand;
            _pasteCommand = pasteCommand;
            _undoCommand = undoCommand;
            _duplicatePageCommand = duplicatePageCommand;
            _deletePageCommand = deletePageCommand;
            InitializeComponent();
            _browser1.Isolator = isolator;
            _splitContainer1.Tag = _splitContainer1.SplitterDistance; //save it
            //don't let it grow automatically
            //            _splitContainer1.SplitterMoved+= ((object sender, SplitterEventArgs e) => _splitContainer1.SplitterDistance = (int)_splitContainer1.Tag);
            SetupThumnailLists();
            _model.SetView(this);
            _browser1.SetEditingCommands(cutCommand, copyCommand, pasteCommand, undoCommand);

            _browser1.GeckoReady += new EventHandler(OnGeckoReady);

            _browser1.ControlKeyEvent = controlKeyEvent;

            if(SIL.PlatformUtilities.Platform.IsMono)
            {
                RepositionButtonsForMono();
                BackgroundColorsForLinux();
            }

            controlKeyEvent.Subscribe(HandleControlKeyEvent);

            // Adding this renderer prevents a white line from showing up under the components.
            _menusToolStrip.Renderer = new FixedToolStripRenderer();

            //we're giving it to the parent control through the TopBarControls property
            Controls.Remove(_topBarPanel);
            SetupBrowserContextMenu();
            #if __MonoCS__
            // The inactive button images look garishly pink on Linux/Mono, but look okay on Windows.
            // Merely introducing an "identity color matrix" to the image attributes appears to fix
            // this problem.  (The active form looks okay with or without this fix.)
            // See http://issues.bloomlibrary.org/youtrack/issue/BL-3714.
            float[][] colorMatrixElements = {
                new float[] {1,  0,  0,  0,  0},		// red scaling factor of 1
                new float[] {0,  1,  0,  0,  0},		// green scaling factor of 1
                new float[] {0,  0,  1,  0,  0},		// blue scaling factor of 1
                new float[] {0,  0,  0,  1,  0},		// alpha scaling factor of 1
                new float[] {0,  0,  0,  0,  1}};		// three translations of 0.0
            var colorMatrix = new ColorMatrix(colorMatrixElements);
            _duplicatePageButton.ImageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
            _deletePageButton.ImageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
            _undoButton.ImageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
            _cutButton.ImageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
            _pasteButton.ImageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
            _copyButton.ImageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
            #endif
        }
Exemple #2
0
        public delegate EditingView Factory();        //autofac uses this


        public EditingView(EditingModel model, PageListView pageListView, TemplatePagesView templatePagesView,
                           CutCommand cutCommand, CopyCommand copyCommand, PasteCommand pasteCommand, UndoCommand undoCommand, DuplicatePageCommand duplicatePageCommand,
                           DeletePageCommand deletePageCommand, NavigationIsolator isolator)
        {
            _model                = model;
            _pageListView         = pageListView;
            _templatePagesView    = templatePagesView;
            _cutCommand           = cutCommand;
            _copyCommand          = copyCommand;
            _pasteCommand         = pasteCommand;
            _undoCommand          = undoCommand;
            _duplicatePageCommand = duplicatePageCommand;
            _deletePageCommand    = deletePageCommand;
            InitializeComponent();
            _browser1.Isolator   = isolator;
            _splitContainer1.Tag = _splitContainer1.SplitterDistance;            //save it
            //don't let it grow automatically
//            _splitContainer1.SplitterMoved+= ((object sender, SplitterEventArgs e) => _splitContainer1.SplitterDistance = (int)_splitContainer1.Tag);
            SetupThumnailLists();
            _model.SetView(this);
            _browser1.SetEditingCommands(cutCommand, copyCommand, pasteCommand, undoCommand);

            _browser1.GeckoReady += new EventHandler(OnGeckoReady);

            _menusToolStrip.Renderer = new FixedToolStripRenderer();

            //we're giving it to the parent control through the TopBarControls property
            Controls.Remove(_topBarPanel);
        }
Exemple #3
0
        private void PerformCut(object obj)
        {
            if ((Shapes.Count <= 0) || (SelectedElements == null))
            {
                return;
            }
            var allLinesToRemove = new List <LineViewModel>();

            StoredElements = SelectedElements;

            foreach (var shape in SelectedElements)
            {
                Shapes.Remove(shape);
                var linesToRemove = Lines.Where(line => (line.ToShape == shape) || (line.FromShape == shape)).ToList();

                foreach (var lineToRemove in linesToRemove)
                {
                    Lines.Remove(lineToRemove);
                    allLinesToRemove.Add(lineToRemove);
                }
            }
            SelectedElements = new List <ShapeViewModel>();
            IUndoRedoCommand cmd = new CutCommand(this, StoredElements, allLinesToRemove);

            _undoRedo.InsertInUndoRedo(cmd);
        }
 private void CanChangeStage()
 {
     if (canCut)
     {
         CutCommand.RaiseCanExecuteChanged();
     }
     else if (canFlowering)
     {
         FloweringStageCommand.RaiseCanExecuteChanged();
     }
     else if (canGrowth)
     {
         GrowthStageCommand.RaiseCanExecuteChanged();
     }
     else if (canGermination)
     {
         GerminationStageCommand.RaiseCanExecuteChanged();
     }
     else if (canSeed)
     {
         SeedStageCommand.RaiseCanExecuteChanged();
     }
     else if (canStart)
     {
         StartCommand.RaiseCanExecuteChanged();
     }
 }
Exemple #5
0
        //autofac uses this
        public EditingView(EditingModel model, PageListView pageListView, TemplatePagesView templatePagesView,
			CutCommand cutCommand, CopyCommand copyCommand, PasteCommand pasteCommand, UndoCommand undoCommand, DeletePageCommand deletePageCommand)
        {
            _model = model;
            _pageListView = pageListView;
            _templatePagesView = templatePagesView;
            _cutCommand = cutCommand;
            _copyCommand = copyCommand;
            _pasteCommand = pasteCommand;
            _undoCommand = undoCommand;
            _deletePageCommand = deletePageCommand;
            InitializeComponent();
            _splitContainer1.Tag = _splitContainer1.SplitterDistance;//save it
            //don't let it grow automatically
            //            _splitContainer1.SplitterMoved+= ((object sender, SplitterEventArgs e) => _splitContainer1.SplitterDistance = (int)_splitContainer1.Tag);
            SetupThumnailLists();
            _model.SetView(this);
            _browser1.SetEditingCommands(cutCommand, copyCommand,pasteCommand, undoCommand);

            _browser1.GeckoReady+=new EventHandler(OnGeckoReady);

            _menusToolStrip.Renderer = new FixedToolStripRenderer();

            //we're giving it to the parent control through the TopBarControls property
            Controls.Remove(_topBarPanel);
        }
Exemple #6
0
 internal void MenuCutClicked(object sender, EventArgs e)
 {
     if (scenarioTreeView.SelectedNode != null)
     {
         ICommand command = new CutCommand(scenarioTreeView.SelectedNodes);
         command.Do();
     }
 }
Exemple #7
0
        private static Command CreateOrderCutCommand(this OrderChange orderChange)
        {
            CutCommand cutCommand = new CutCommand();

            cutCommand.AccountID = orderChange.AccountId;
            cutCommand.Content   = orderChange.CreateOrderCutXml().ToXmlNode();
            return(cutCommand);
        }
Exemple #8
0
        public async Task Cut()
        {
            var result = await DoCommand(async() => {
                var playerId = _account.PlayerId;

                var command = new CutCommand(playerId);
                await _bus.SendCommand(command);
            });
        }
Exemple #9
0
        public async Task <Unit> Handle(CutCommand command, CancellationToken cancellationToken)
        {
            await BeginChangeStatus(new PlayerStatusModel
            {
                PlayerId = command.PlayerId,
                Status   = PlayerStatusEnum.伐木
            });

            return(Unit.Value);
        }
Exemple #10
0
        public void InvokeBothCommand()
        {
            CutCommand    cut    = new CutCommand(new Receiver());
            DeleteCommand delete = new DeleteCommand(new Receiver());

            invoker.Execute();

            cut.Message.Should().BeEquivalentTo("Command Cut is executed.");
            delete.Message.Should().BeEquivalentTo("Command Delete is cancelled.");
        }
Exemple #11
0
        public void ShouldInvokeCommand()
        {
            CutCommand cut = new CutCommand(new Receiver());

            invoker.Commands.Add(cut);

            invoker.Execute();

            cut.Message.Should().BeEquivalentTo("Command Cut is executed.");
        }
Exemple #12
0
 internal void DeselectAllShapes()
 {
     foreach (IShape shape in Selected)
     {
         shape.IsSelected = false;
     }
     Selected.Clear();
     DeleteSelectedShapesCommand.RaiseCanExecuteChanged();
     CopyCommand.RaiseCanExecuteChanged();
     CutCommand.RaiseCanExecuteChanged();
 }
Exemple #13
0
        private void AfterDragEnded(object sender, NodeDraggedEventArgs e)
        {
            FolderTestCase testcase = e.TargetNode.Testcase as FolderTestCase;

            if (testcase != null)
            {
                ICommand command = new CutCommand(new QAliberTreeNode[] { (QAliberTreeNode)e.SourceNode });
                command.Do();
                command = new PasteCommand(e.TargetNode);
                commandsHistory.Do(command);
                OnScenarioChanged();
            }
        }
Exemple #14
0
        private void ToolbarButton_Click(object sender, RoutedEventArgs e)
        {
            try {
                switch ((sender as FrameworkElement).Tag.ToString().Replace("toolbar.", ""))
                {
                case "new":
                    NewFileCommand.Execute(null);
                    break;

                case "open":
                    OpenFileCommand.Execute(null);
                    break;

                case "save":
                    SaveFileCommand.Execute(null);
                    break;

                case "cut":
                    CutCommand.Execute(null);
                    break;

                case "copy":
                    CopyCommand.Execute(null);
                    break;

                case "paste":
                    PasteCommand.Execute(null);
                    break;

                case "build":
                    BuildRunCommand.Execute(false);
                    break;

                case "buildrun":
                    BuildRunCommand.Execute(true);
                    break;

                case "close":
                    CloseTabCommand.Execute(null);
                    break;
                }
            } catch (Exception ex) {
                Debug.Fail(ex.Message);
            }
        }
Exemple #15
0
        private void SelectedItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (SelectedItems.Count == 1)
            {
                SelectedItem = SelectedItems.First();
            }
            else
            {
                SelectedItem = null;
            }

            CopyCommand.RaiseCanExecuteChanged();
            CutCommand.RaiseCanExecuteChanged();
            PasteCommand.RaiseCanExecuteChanged();
            CreateGroupCommand.RaiseCanExecuteChanged();
            MoveToGroupCommand.RaiseCanExecuteChanged();
            CreateNodeCommand.RaiseCanExecuteChanged();
        }
Exemple #16
0
 public EditCommand(UndoCommand undoCommand, RedoCommand redoCommand, CutCommand cutCommand,
                    CopyCommand copyCommand, PasteCommand pasteCommand, SelectAllCommand selectAllCommand,
                    ExponentCommand exponentCommand)
     : base(MenuStrings.editToolStripMenuItem1_Text)
 {
     ChildrenCommands = new List <IToolbarCommand>
     {
         undoCommand,
         redoCommand,
         null,
         cutCommand,
         copyCommand,
         pasteCommand,
         null,
         selectAllCommand,
         null,
         exponentCommand
     };
 }
Exemple #17
0
 /// <summary>
 /// Raises commands can execute event.
 /// </summary>
 public virtual void UpdateCommandsCanExecute()
 {
     if (this.DeleteCommand != null)
     {
         DeleteCommand.RaiseCanExecuteChanged();
     }
     if (this.CutCommand != null)
     {
         CutCommand.RaiseCanExecuteChanged();
     }
     if (this.CopyCommand != null)
     {
         CopyCommand.RaiseCanExecuteChanged();
     }
     if (this.PasteCommand != null)
     {
         PasteCommand.RaiseCanExecuteChanged();
     }
 }
Exemple #18
0
        /// <summary>
        /// Cut selected items
        /// </summary>
        /// <returns>
        /// true if at least one object is cut
        /// </returns>
        public void CutSelection()
        {
            int i;
            int n = _graphicsList.Count;

            _inMemoryList.Clear();
            for (i = n - 1; i >= 0; i--)
            {
                if (((DrawObject)_graphicsList[i]).Selected)
                {
                    _inMemoryList.Add(_graphicsList[i]);
                }
            }
            _isCut = true;

            var cmd = new CutCommand(_graphicsList, _inMemoryList);

            cmd.Execute();
            _undoRedo.AddCommand(cmd);
        }
Exemple #19
0
        public Data()
        {
            //File
            NewProjectCommand  = new NewProjectCommand();
            OpenProjectCommand = new OpenProjectCommand();
            ExitCommand        = new ExitCommand();
            SaveCommand        = new SaveCommand();
            SaveAsCommand      = new SaveAsCommand();

            //Edit
            CopyCommand   = new CopyCommand();
            CutCommand    = new CutCommand();
            DeleteCommand = new DeleteCommand();
            PasteCommand  = new PasteCommand();
            RedoCommand   = new RedoCommand();
            UndoCommand   = new UndoCommand();

            //View
            StatusbarToggleCommand = new StatusbarToggleCommand();
            ToolboxToggleCommand   = new ToolboxToggleCommand();
            ZoomInCommand          = new ZoomInCommand();
            ZoomOutCommand         = new ZoomOutCommand();

            //Insert
            NewClassCommand      = new NewClassCommand();
            NewDependencyCommand = new NewDependencyCommand();
            NewTextBoxCommand    = new NewTextBoxCommand();

            //Help
            HelpCommand  = new HelpCommand();
            AboutCommand = new AboutCommand();

            //StatusBar
            resetStatusBar();
            StatusBarVisability = "Visible";
            ToolBoxVisability   = "Visible";
        }
Exemple #20
0
 internal void SelectShape(IShape shape, bool clearSelection)
 {
     if (shape == null)
     {
         return;
     }
     if (clearSelection)
     {
         DeselectAllShapes();
         Selected.Add(shape);
         shape.IsSelected = true;
         DeleteSelectedShapesCommand.RaiseCanExecuteChanged();
         CopyCommand.RaiseCanExecuteChanged();
         CutCommand.RaiseCanExecuteChanged();
     }
     else
     {
         Selected.Add(shape);
         shape.IsSelected = true;
         DeleteSelectedShapesCommand.RaiseCanExecuteChanged();
         CopyCommand.RaiseCanExecuteChanged();
         CutCommand.RaiseCanExecuteChanged();
     }
 }
        private static Message Convert(string exchangeCode, CutCommand cutCommand)
        {
            XmlNode transactionNode = cutCommand.Content["Transaction"];

            Transaction[] transactions;
            Order[] orders;
            OrderRelation[] orderRelations;

            CommandConvertor.Parse(exchangeCode,transactionNode, out transactions, out orders, out orderRelations);
            CutMessage cutMessage = new CutMessage { ExchangeCode = exchangeCode, Transactions = transactions, Orders = orders, OrderRelations = orderRelations };
            return cutMessage;
        }
Exemple #22
0
        private void CreateCommands()
        {
            DocumentCommands.Clear();

            // Commands to ToolStrip
            ICommand copyCommand    = new CopyCommand(this);
            ICommand pasteCommand   = new PasteCommand(this);
            ICommand cutCommand     = new CutCommand(this);
            ICommand bindingCommand = new CommonBindingCommand(this);

            var blankBitmap = new System.Drawing.Bitmap(10, 10);

            // Commands to ToolStrip
            DocumentCommands.Add(new CommandInfo(new NullCommand((int)CommandManager.Priorities.EditCommands),
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar })); // Separator
            DocumentCommands.Add(new CommandInfo(_undoCommand = new UndoCommand(this),
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar }));
            DocumentCommands.Add(new CommandInfo(_redoCommand = new RedoCommand(this),
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar }));
            DocumentCommands.Add(new CommandInfo(new NullCommand((int)CommandManager.Priorities.EditCommands),
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar })); // Separator
            DocumentCommands.Add(new CommandInfo(cutCommand,
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar }));
            DocumentCommands.Add(new CommandInfo(copyCommand,
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar }));
            DocumentCommands.Add(new CommandInfo(pasteCommand,
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar }));
            DocumentCommands.Add(new CommandInfo(new NullCommand((int)CommandManager.Priorities.EditCommands),
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar })); // Separator
            DocumentCommands.Add(new CommandInfo(new XamlViewCommand(this),
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar }));
            DocumentCommands.Add(new CommandInfo(new GroupCommand(this),
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar }));
            DocumentCommands.Add(new CommandInfo(new UngroupCommand(this),
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar }));
            DocumentCommands.Add(new CommandInfo(new NullCommand((int)CommandManager.Priorities.EditCommands),
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar })); // Separator

            DocumentCommands.Add(new CommandInfo(new ZMoveTopCommand(this),
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar }));
            DocumentCommands.Add(new CommandInfo(new ZMoveBottomCommand(this),
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar }));
            DocumentCommands.Add(new CommandInfo(new NullCommand((int)CommandManager.Priorities.EditCommands),
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar })); // Separator
            DocumentCommands.Add(new CommandInfo(bindingCommand,
                                                 new string[] { "DocumentContext", PredefinedContexts.GlobalToolbar }));


            DocumentCommands.Add(new CommandInfo(new NullCommand((int)CommandManager.Priorities.ViewCommands),
                                                 new string[] { "ViewContext" }));
            DocumentCommands.Add(new CommandInfo(new ZoomLevelCommand(this),
                                                 new string[] { "ViewContext" }));
            DocumentCommands.Add(new CommandInfo(new ZoomOutCommand(this),
                                                 new string[] { "ViewContext" }));
            DocumentCommands.Add(new CommandInfo(new ZoomInCommand(this),
                                                 new string[] { "ViewContext" }));

            /*DocumentCommands.Add(new CommandInfo(cutCommand, _documentMenuContext));
             * DocumentCommands.Add(new CommandInfo(copyCommand, _documentMenuContext));
             * DocumentCommands.Add(new CommandInfo(pasteCommand, _documentMenuContext));
             * DocumentCommands.Add(new CommandInfo(bindingCommand, _documentMenuContext));
             * */
            DocumentCommands.Add(new CommandInfo(new ImportElementCommand(this),
                                                 new string[] { "FileContext" }));


            DocumentCommands.Add(new CommandInfo(
                                     new ToolCommand(this,
                                                     StringResources.ToolSelection,
                                                     StringResources.ToolEditorGroupName,
                                                     global::FreeSCADA.Designer.Resources.cursor,
                                                     typeof(SelectionTool)),
                                     new string[] { "ToolboxContext" }));

            DocumentCommands.Add(new CommandInfo(
                                     new ToolCommand(this,
                                                     StringResources.ToolRectangle,
                                                     StringResources.ToolGrphicsGroupName,
                                                     global::FreeSCADA.Designer.Resources.shape_square_add,
                                                     typeof(RectangleTool)),
                                     new string[] { "ViewContext" }));

            DocumentCommands.Add(new CommandInfo(
                                     new ToolCommand(this,
                                                     StringResources.ToolEllipse,
                                                     StringResources.ToolGrphicsGroupName,
                                                     global::FreeSCADA.Designer.Resources.shape_ellipse_add,
                                                     typeof(EllipseTool)),
                                     new string[] { "ToolboxContext" }));

            DocumentCommands.Add(new CommandInfo(
                                     new ToolCommand(this,
                                                     StringResources.ToolTextbox,
                                                     StringResources.ToolGrphicsGroupName,
                                                     global::FreeSCADA.Designer.Resources.textfield_add,
                                                     typeof(TextBoxTool)),
                                     new string[] { "ToolboxContext" }));

            DocumentCommands.Add(new CommandInfo(
                                     new ToolCommand(this,
                                                     StringResources.ToolPolyline,
                                                     StringResources.ToolGrphicsGroupName,
                                                     global::FreeSCADA.Designer.Resources.shape_line_add,
                                                     typeof(PolylineTool)),
                                     new string[] { "ToolboxContext" }));
            DocumentCommands.Add(new CommandInfo(
                                     new ToolCommand(this,
                                                     StringResources.ToolPolygon,
                                                     StringResources.ToolGrphicsGroupName,
                                                     global::FreeSCADA.Designer.Resources.shape_line_add,
                                                     typeof(PolygonTool)),
                                     new string[] { "ToolboxContext" }));

            /*DocumentCommands.Add(new CommandInfo(
             *  new ToolCommand(this,
             *      StringResources.ToolActionEdit,
             *      StringResources.ToolEditorGroupName,
             *      global::FreeSCADA.Designer.Resources.cog_edit,
             *      typeof(ActionEditTool)),
             *      CommandManager.toolboxContext));*/

            DocumentCommands.Add(new CommandInfo(
                                     new ToolCommand(this,
                                                     StringResources.ToolButton,
                                                     StringResources.ToolControlsGroupName,
                                                     blankBitmap,
                                                     typeof(ControlCreateTool <System.Windows.Controls.Button>)),
                                     new string[] { "ToolboxContext" }));

            DocumentCommands.Add(new CommandInfo(
                                     new ToolCommand(this,
                                                     StringResources.ToolToggleButton,
                                                     StringResources.ToolControlsGroupName,
                                                     blankBitmap,
                                                     typeof(ControlCreateTool <System.Windows.Controls.Primitives.ToggleButton>)),
                                     new string[] { "ToolboxContext" }));

            DocumentCommands.Add(new CommandInfo(
                                     new ToolCommand(this,
                                                     StringResources.ToolProgressbar,
                                                     StringResources.ToolControlsGroupName,
                                                     blankBitmap,
                                                     typeof(ControlCreateTool <System.Windows.Controls.ProgressBar>)),
                                     new string[] { "ToolboxContext" }));

            DocumentCommands.Add(new CommandInfo(
                                     new ToolCommand(this,
                                                     StringResources.ToolScrollbar,
                                                     StringResources.ToolControlsGroupName,
                                                     blankBitmap,
                                                     typeof(ControlCreateTool <System.Windows.Controls.Primitives.ScrollBar>)),
                                     new string[] { "ToolboxContext" }));

            DocumentCommands.Add(new CommandInfo(
                                     new ToolCommand(this,
                                                     StringResources.ToolImageControl,
                                                     StringResources.ToolControlsGroupName,
                                                     blankBitmap,
                                                     typeof(ControlCreateTool <FreeSCADA.Common.Schema.AnimatedImage>)),
                                     new string[] { "ToolboxContext" }));

            DocumentCommands.Add(new CommandInfo(
                                     new ToolCommand(this,
                                                     StringResources.ToolSlider,
                                                     StringResources.ToolControlsGroupName,
                                                     blankBitmap,
                                                     typeof(ControlCreateTool <System.Windows.Controls.Slider>)),
                                     new string[] { "ToolboxContext" }));

            DocumentCommands.Add(new CommandInfo(
                                     new ToolCommand(this,
                                                     StringResources.CheckBox,
                                                     StringResources.ToolControlsGroupName,
                                                     blankBitmap,
                                                     typeof(ControlCreateTool <System.Windows.Controls.CheckBox>)),
                                     new string[] { "ToolboxContext" }));

            DocumentCommands.Add(new CommandInfo(
                                     new ToolCommand(this,
                                                     StringResources.TextBox,
                                                     StringResources.ToolControlsGroupName,
                                                     blankBitmap,
                                                     typeof(ControlCreateTool <System.Windows.Controls.TextBox>)),
                                     new string[] { "ToolboxContext" }));

            DocumentCommands.Add(new CommandInfo(
                                     new ToolCommand(this,
                                                     StringResources.ToolChart,
                                                     StringResources.ToolControlsGroupName,
                                                     blankBitmap,
                                                     typeof(ControlCreateTool <TimeChartControl>)),
                                     new string[] { "ToolboxContext" }));
        }
Exemple #23
0
        void WpfKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key == System.Windows.Input.Key.Z &&
                (System.Windows.Input.Keyboard.Modifiers & System.Windows.Input.ModifierKeys.Control) != System.Windows.Input.ModifierKeys.None)
            {
                UndoBuff.UndoCommand();
                //SelectionManager.SelectObject(null);
            }
            else if (e.Key == System.Windows.Input.Key.Y &&
                     (System.Windows.Input.Keyboard.Modifiers & System.Windows.Input.ModifierKeys.Control) != System.Windows.Input.ModifierKeys.None)
            {
                UndoBuff.RedoCommand();
                //SelectionManager.SelectObject(null);
            }
            else if (e.Key == System.Windows.Input.Key.X &&
                     (System.Windows.Input.Keyboard.Modifiers & System.Windows.Input.ModifierKeys.Control) != System.Windows.Input.ModifierKeys.None)
            {
                if (_activeTool is SelectionTool && SelectionManager.SelectedObjects.Count > 0)
                {
                    var cmd = new CutCommand(this);
                    cmd.CheckApplicability();
                    cmd.Execute();
                    cmd.Dispose();
                }
            }
            else if (e.Key == System.Windows.Input.Key.C &&
                     (System.Windows.Input.Keyboard.Modifiers & System.Windows.Input.ModifierKeys.Control) != System.Windows.Input.ModifierKeys.None)
            {
                if (_activeTool is SelectionTool && SelectionManager.SelectedObjects.Count > 0)
                {
                    var cmd = new CopyCommand(this);
                    cmd.Execute();
                    cmd.Dispose();
                }
            }
            else if (e.Key == System.Windows.Input.Key.V &&
                     (System.Windows.Input.Keyboard.Modifiers & System.Windows.Input.ModifierKeys.Control) != System.Windows.Input.ModifierKeys.None)
            {
                if (_activeTool is SelectionTool)
                {
                    var cmd = new PasteCommand(this);
                    cmd.Execute();
                    cmd.Dispose();
                }
            }
            else if (e.Key == System.Windows.Input.Key.Delete)
            {
                if (SelectionManager.SelectedObjects.Count > 0)
                {
                    UndoBuff.AddCommand(new DeleteGraphicsObject(SelectionManager.SelectedObjects.Cast <FrameworkElement>().FirstOrDefault()));
                }
                else if (_activeTool is SelectionTool && SelectionManager.SelectedObjects.Count > 0)
                {
                    foreach (var el in SelectionManager.SelectedObjects.Cast <FrameworkElement>())
                    {
                        UndoBuff.AddCommand(new DeleteGraphicsObject(el));
                    }
                }
                SelectionManager.SelectObject(null);
            }
            else if (e.Key == System.Windows.Input.Key.Add && (System.Windows.Input.Keyboard.Modifiers & System.Windows.Input.ModifierKeys.Control) != System.Windows.Input.ModifierKeys.None)
            {
                DocumentCommands.First(c => c.command is ZoomInCommand).command.Execute();
            }
            else if (e.Key == System.Windows.Input.Key.Subtract && (System.Windows.Input.Keyboard.Modifiers & System.Windows.Input.ModifierKeys.Control) != System.Windows.Input.ModifierKeys.None)
            {
                DocumentCommands.First(c => c.command is ZoomOutCommand).command.Execute();
            }

            else if (e.Key == System.Windows.Input.Key.Escape)
            {
                //NotifySetCurrentTool(toolsList[0]);
            }
            else if (e.Key == System.Windows.Input.Key.F5)
            {
                UpdateCanvasByXaml();
            }
            else if (_activeTool is SelectionTool)
            {
                if (e.Key == System.Windows.Input.Key.Left)
                {
                    (_activeTool as SelectionTool).MoveHelper(-1, 0);
                }
                if (e.Key == System.Windows.Input.Key.Right)
                {
                    (_activeTool as SelectionTool).MoveHelper(1, 0);
                }
                if (e.Key == System.Windows.Input.Key.Up)
                {
                    (_activeTool as SelectionTool).MoveHelper(0, -1);
                }
                if (e.Key == System.Windows.Input.Key.Down)
                {
                    (_activeTool as SelectionTool).MoveHelper(0, 1);
                }
            }


            MainPanel.UpdateLayout();
        }
Exemple #24
0
 public ToolBarView(NewCommand newCommand, OpenCommand openCommand, SaveCommand saveCommand, PrintCommand printCommand, CutCommand cutCommand, CopyCommand copyCommand, PasteCommand pasteCommand, HelpCommand helpCommand, ExponentCommand exponentCommand, RunCommand runCommand) : this()
 {
     SetCommands(newCommand, openCommand, saveCommand, null, printCommand, cutCommand, copyCommand, pasteCommand, null, helpCommand, null, exponentCommand, null, runCommand);
 }