public MarginCommand(CommandManager commandManager) : base(CommandId.MarginsGroup) { RepresentativeString = Res.Get(StringId.SpinnerPixelRepresentativeString); FormatString = Res.Get(StringId.SpinnerPixelFormatString); // @RIBBON TODO: Have a way to initialize this. marginValue = new Padding(Convert.ToInt32(MinMargin)); commandManager.BeginUpdate(); commandLeftMargin = new SpinnerCommand(CommandId.AdjustLeftMargin, MinMargin, MaxMargin, MinMargin, Increment, DecimalPlaces, RepresentativeString, FormatString); commandManager.Add(commandLeftMargin, commandMargin_ExecuteWithArgs); commandTopMargin = new SpinnerCommand(CommandId.AdjustTopMargin, MinMargin, MaxMargin, MinMargin, Increment, DecimalPlaces, RepresentativeString, FormatString); commandManager.Add(commandTopMargin, commandMargin_ExecuteWithArgs); commandRightMargin = new SpinnerCommand(CommandId.AdjustRightMargin, MinMargin, MaxMargin, MinMargin, Increment, DecimalPlaces, RepresentativeString, FormatString); commandManager.Add(commandRightMargin, commandMargin_ExecuteWithArgs); commandBottomMargin = new SpinnerCommand(CommandId.AdjustBottomMargin, MinMargin, MaxMargin, MinMargin, Increment, DecimalPlaces, RepresentativeString, FormatString); commandManager.Add(commandBottomMargin, commandMargin_ExecuteWithArgs); commandManager.EndUpdate(); }
private void InitializeSizeChunkCommands() { _imageCropCommand = new Command(CommandId.ImageCrop); _imageCropCommand.Tag = _imageEditingContext.DecoratorsManager.GetImageDecorator(CropDecorator.Id); _imageCropCommand.Execute += new EventHandler(imageDecoratorCommand_Execute); //Note: this handles its own undo _commandManager.Add(_imageCropCommand); _imageWidthCommand = new ImageSizeSpinnerCommand(CommandId.FormatImageAdjustWidth); _imageWidthCommand.Tag = _imageEditingContext.DecoratorsManager.GetImageDecorator(HtmlImageResizeDecorator.Id); _imageWidthCommand.ExecuteWithArgs += new ExecuteEventHandler(imageSizeCommand_ExecuteWithArgs); _commandManager.Add(_imageWidthCommand); _imageHeightCommand = new ImageSizeSpinnerCommand(CommandId.FormatImageAdjustHeight); _imageHeightCommand.Tag = _imageEditingContext.DecoratorsManager.GetImageDecorator(HtmlImageResizeDecorator.Id); _imageHeightCommand.ExecuteWithArgs += new ExecuteEventHandler(imageSizeCommand_ExecuteWithArgs); _commandManager.Add(_imageHeightCommand); _customSizeDropDownCommand = new Command(CommandId.CustomSizeGallery); _commandManager.Add(_customSizeDropDownCommand); _customSizeSmallCommand = new Command(CommandId.CustomSizeSmall, ImageSizeName.Small); _commandManager.Add(_customSizeSmallCommand); _customSizeMediumCommand = new Command(CommandId.CustomSizeMedium, ImageSizeName.Medium); _commandManager.Add(_customSizeMediumCommand); _customSizeLargeCommand = new Command(CommandId.CustomSizeLarge, ImageSizeName.Large); _commandManager.Add(_customSizeLargeCommand); _customSizeOriginalCommand = new Command(CommandId.CustomSizeOriginal, ImageSizeName.Full); _commandManager.Add(_customSizeOriginalCommand); _imageCustomSizeDropdown = new ImageCustomSizeDropdown(_customSizeDropDownCommand, new[] { _customSizeSmallCommand, _customSizeMediumCommand, _customSizeLargeCommand, _customSizeOriginalCommand }, customSizeCommand_Execute); _customSizeDefaultsCommand = new GroupCommand(CommandId.SetCustomSizeDefaults, _customSizeDropDownCommand); _customSizeDefaultsCommand.Execute += new EventHandler(customSizeDefaultsCommand_Execute); _commandManager.Add(_customSizeDefaultsCommand); _aspectRatioLockedCommand = new Command(CommandId.FormatImageLockAspectRatio); _aspectRatioLockedCommand.Execute += new EventHandler(aspectRatioLockedCommand_Execute); _commandManager.Add(_aspectRatioLockedCommand); _commandManager.Add(new GroupCommand(CommandId.FormatImageSizeGroup, _customSizeDropDownCommand)); }