private DialogResult EditTargetOptions() { using (LinkToOptionsForm linkOptionsForm = new LinkToOptionsForm()) { if (SelectedLinkTarget == LinkTargetType.IMAGE) { using (ImageTargetEditorControl editor = new ImageTargetEditorControl()) { editor.LoadImageSize(HtmlImageTargetSettings.ImageSize, EditorContext.SourceImageSize, EditorContext.ImageRotation); editor.LinkOptions = HtmlImageTargetSettings.LinkOptions; editor.EditorOptions = ImageEditingContext.EditorOptions; linkOptionsForm.EditorControl = editor; HtmlImageTargetSettings.DhtmlImageViewer = ImageEditingContext.EditorOptions.DhtmlImageViewer; DialogResult result = linkOptionsForm.ShowDialog(this); if (result == DialogResult.OK) { HtmlImageTargetSettings.ImageSize = editor.ImageSize; HtmlImageTargetSettings.DhtmlImageViewer = ImageEditingContext.EditorOptions.DhtmlImageViewer; HtmlImageTargetSettings.LinkOptions = editor.LinkOptions; HtmlImageTargetSettings.ImageSizeName = editor.ImageBoundsSize; } return(result); } } else if (SelectedLinkTarget == LinkTargetType.URL) { using (HyperlinkForm hyperlinkForm = new HyperlinkForm(EditorContext.CommandManager, GlobalEditorOptions.SupportsFeature(ContentEditorFeature.ShowAllLinkOptions))) { hyperlinkForm.ContainsImage = true; hyperlinkForm.EditStyle = HtmlImageTargetSettings.LinkTargetUrl != null && HtmlImageTargetSettings.LinkTargetUrl != String.Empty; hyperlinkForm.NewWindow = HtmlImageTargetSettings.LinkOptions.ShowInNewWindow; if (HtmlImageTargetSettings.LinkTitle != String.Empty) { hyperlinkForm.LinkTitle = HtmlImageTargetSettings.LinkTitle; } if (HtmlImageTargetSettings.LinkRel != String.Empty) { hyperlinkForm.Rel = HtmlImageTargetSettings.LinkRel; } if (HtmlImageTargetSettings.LinkTargetUrl != null && HtmlImageTargetSettings.LinkTarget != LinkTargetType.IMAGE) { hyperlinkForm.Hyperlink = HtmlImageTargetSettings.LinkTargetUrl; } DialogResult result = hyperlinkForm.ShowDialog(FindForm()); if (result == DialogResult.OK) { HtmlImageTargetSettings.LinkTargetUrl = hyperlinkForm.Hyperlink; HtmlImageTargetSettings.UpdateImageLinkOptions(hyperlinkForm.LinkTitle, hyperlinkForm.Rel, hyperlinkForm.NewWindow); HtmlImageTargetSettings.LinkOptions = new LinkOptions(hyperlinkForm.NewWindow, false, null); } return(result); } } return(DialogResult.Abort); } }
private DialogResult EditTargetOptions() { using (LinkToOptionsForm linkOptionsForm = new LinkToOptionsForm()) { if (SelectedLinkTarget == LinkTargetType.IMAGE) { using (ImageTargetEditorControl editor = new ImageTargetEditorControl()) { editor.LoadImageSize(HtmlImageTargetSettings.ImageSize, EditorContext.SourceImageSize, EditorContext.ImageRotation); editor.LinkOptions = HtmlImageTargetSettings.LinkOptions; editor.EditorOptions = ImageEditingContext.EditorOptions; linkOptionsForm.EditorControl = editor; HtmlImageTargetSettings.DhtmlImageViewer = ImageEditingContext.EditorOptions.DhtmlImageViewer; DialogResult result = linkOptionsForm.ShowDialog(this); if (result == DialogResult.OK) { HtmlImageTargetSettings.ImageSize = editor.ImageSize; HtmlImageTargetSettings.DhtmlImageViewer = ImageEditingContext.EditorOptions.DhtmlImageViewer; HtmlImageTargetSettings.LinkOptions = editor.LinkOptions; HtmlImageTargetSettings.ImageSizeName = editor.ImageBoundsSize; } return result; } } else if (SelectedLinkTarget == LinkTargetType.URL) { using (HyperlinkForm hyperlinkForm = new HyperlinkForm(EditorContext.CommandManager, GlobalEditorOptions.SupportsFeature(ContentEditorFeature.ShowAllLinkOptions))) { hyperlinkForm.ContainsImage = true; hyperlinkForm.EditStyle = HtmlImageTargetSettings.LinkTargetUrl != null && HtmlImageTargetSettings.LinkTargetUrl != String.Empty; hyperlinkForm.NewWindow = HtmlImageTargetSettings.LinkOptions.ShowInNewWindow; if (HtmlImageTargetSettings.LinkTitle != String.Empty) hyperlinkForm.LinkTitle = HtmlImageTargetSettings.LinkTitle; if (HtmlImageTargetSettings.LinkRel != String.Empty) hyperlinkForm.Rel = HtmlImageTargetSettings.LinkRel; if (HtmlImageTargetSettings.LinkTargetUrl != null && HtmlImageTargetSettings.LinkTarget != LinkTargetType.IMAGE) { hyperlinkForm.Hyperlink = HtmlImageTargetSettings.LinkTargetUrl; } DialogResult result = hyperlinkForm.ShowDialog(FindForm()); if (result == DialogResult.OK) { HtmlImageTargetSettings.LinkTargetUrl = hyperlinkForm.Hyperlink; HtmlImageTargetSettings.UpdateImageLinkOptions(hyperlinkForm.LinkTitle, hyperlinkForm.Rel, hyperlinkForm.NewWindow); HtmlImageTargetSettings.LinkOptions = new LinkOptions(hyperlinkForm.NewWindow, false, null); } return result; } } return DialogResult.Abort; } }
private DialogResult EditTargetOptions(LinkTargetType linkTargetType) { using (LinkToOptionsForm linkOptionsForm = new LinkToOptionsForm()) { if (linkTargetType == LinkTargetType.IMAGE) { using (ImageTargetEditorControl editor = new ImageTargetEditorControl()) { editor.LoadImageSize(ImagePropertiesInfo.LinkTargetImageSize, ImagePropertiesInfo.ImageSourceSize, ImagePropertiesInfo.ImageRotation); editor.LinkOptions = ImagePropertiesInfo.LinkOptions; editor.EditorOptions = _imageEditingContext.EditorOptions; linkOptionsForm.EditorControl = editor; ImagePropertiesInfo.DhtmlImageViewer = _imageEditingContext.EditorOptions.DhtmlImageViewer; DialogResult result = linkOptionsForm.ShowDialog(_editorContext.MainFrameWindow); if (result == DialogResult.OK) { ImagePropertiesInfo.LinkTargetImageSize = editor.ImageSize; ImagePropertiesInfo.DhtmlImageViewer = _imageEditingContext.EditorOptions.DhtmlImageViewer; ImagePropertiesInfo.LinkOptions = editor.LinkOptions; ImagePropertiesInfo.LinkTargetImageSizeName = editor.ImageBoundsSize; } return result; } } else if (linkTargetType == LinkTargetType.URL) { using (HyperlinkForm hyperlinkForm = new HyperlinkForm(_editorContext.CommandManager, GlobalEditorOptions.SupportsFeature(ContentEditorFeature.ShowAllLinkOptions))) { hyperlinkForm.ContainsImage = true; hyperlinkForm.EditStyle = !String.IsNullOrEmpty(ImagePropertiesInfo.LinkTargetUrl); hyperlinkForm.NewWindow = ImagePropertiesInfo.LinkOptions.ShowInNewWindow; if (ImagePropertiesInfo.LinkTitle != String.Empty) hyperlinkForm.LinkTitle = ImagePropertiesInfo.LinkTitle; if (ImagePropertiesInfo.LinkRel != String.Empty) hyperlinkForm.Rel = ImagePropertiesInfo.LinkRel; if (ImagePropertiesInfo.LinkTargetUrl != null && ImagePropertiesInfo.LinkTarget != LinkTargetType.IMAGE) { hyperlinkForm.Hyperlink = ImagePropertiesInfo.LinkTargetUrl; } DialogResult result = hyperlinkForm.ShowDialog(_editorContext.MainFrameWindow); if (result == DialogResult.OK) { ImagePropertiesInfo.LinkTargetUrl = hyperlinkForm.Hyperlink; ImagePropertiesInfo.UpdateImageLinkOptions(hyperlinkForm.LinkTitle, hyperlinkForm.Rel, hyperlinkForm.NewWindow); ImagePropertiesInfo.LinkOptions = new LinkOptions(hyperlinkForm.NewWindow, false, null); } return result; } } return DialogResult.Abort; } }