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; } }