public DraftPostItemsGalleryCommand(IBlogPostEditingSite postEditingSite, CommandManager commandManager, bool isPost) : base((isPost ? CommandId.OpenPostSplit : CommandId.OpenDraftSplit)) { this.postEditingSite = postEditingSite; _isPost = isPost; if (isPost) { draftCmdStart = (int)CommandId.OpenPostMRU0; } lock (_commandsLock) { // initialize commands for (int i = 0; i < _commands.Length; i++) { _commands[i] = new Command((CommandId)(i + draftCmdStart)); _commands[i].Execute += new EventHandler(DraftPostItemsGalleryCommand_Execute); _commands[i].CommandBarButtonStyle = CommandBarButtonStyle.Provider; _commands[i].On = false; } // add them to the command manager commandManager.Add(new CommandCollection(_commands)); commandManager.Add(this); } }
public SemanticHtmlGalleryCommand(CommandId commandId, IBlogPostEditingSite editingSite, TemplateHtmlDelegate templateHtmlDelegate, CommandManager commandManager, IHtmlEditorComponentContext componentContext) : base(commandId) { _editingSite = editingSite; _componentContext = componentContext; _elements = new List <SemanticHtmlElementInfo>(7); _elements.Add(new SemanticHtmlElementInfo("p", _ELEMENT_TAG_ID.TAGID_P, Res.Get(StringId.Paragraph), SemanticHtmlPreviewManager.PreviewId_P, CommandId.ApplySemanticParagraph)); _elements.Add(new SemanticHtmlElementInfo("h1", _ELEMENT_TAG_ID.TAGID_H1, Res.Get(StringId.Heading1), SemanticHtmlPreviewManager.PreviewId_H1, CommandId.ApplySemanticHeader1)); _elements.Add(new SemanticHtmlElementInfo("h2", _ELEMENT_TAG_ID.TAGID_H2, Res.Get(StringId.Heading2), SemanticHtmlPreviewManager.PreviewId_H2, CommandId.ApplySemanticHeader2)); _elements.Add(new SemanticHtmlElementInfo("h3", _ELEMENT_TAG_ID.TAGID_H3, Res.Get(StringId.Heading3), SemanticHtmlPreviewManager.PreviewId_H3, CommandId.ApplySemanticHeader3)); _elements.Add(new SemanticHtmlElementInfo("h4", _ELEMENT_TAG_ID.TAGID_H4, Res.Get(StringId.Heading4), SemanticHtmlPreviewManager.PreviewId_H4, CommandId.ApplySemanticHeader4)); _elements.Add(new SemanticHtmlElementInfo("h5", _ELEMENT_TAG_ID.TAGID_H5, Res.Get(StringId.Heading5), SemanticHtmlPreviewManager.PreviewId_H5, CommandId.ApplySemanticHeader5)); _elements.Add(new SemanticHtmlElementInfo("h6", _ELEMENT_TAG_ID.TAGID_H6, Res.Get(StringId.Heading6), SemanticHtmlPreviewManager.PreviewId_H6, CommandId.ApplySemanticHeader6)); _previewManager = new SemanticHtmlPreviewManager(_editingSite, templateHtmlDelegate, RibbonHelper.InGalleryImageWidth, RibbonHelper.InGalleryImageHeightWithoutLabel); _ids = new string[_elements.Count]; for (int i = 0; i < _ids.Length; i++) { _ids[i] = _elements[i].HtmlId; int index = i; OverridableCommand command = new OverridableCommand(_elements[i].CommandId); command.Execute += (sender, e) => SelectedIndex = index; commandManager.Add(command); } }
public WeblogAccountManagementForm(IBlogPostEditingSite editingSite) { // // Required for Windows Form Designer support // InitializeComponent(); weblogAccountManagementControl1.EditingSite = editingSite; }
public PostEditorPreferencesEditor(IWin32Window owner, IBlogPostEditingSite editingSite) { // save reference to owner _owner = owner; _editingSite = editingSite; // initialize commands InitializeCommands(); }
public WeblogAccountManagementForm(IBlogPostEditingSite editingSite) { // // Required for Windows Form Designer support // InitializeComponent(); weblogAccountManagementControl1.EditingSite = editingSite ; }
public ContentEditor(IMainFrameWindow mainFrameWindow, Control editorContainer, IBlogPostEditingSite postEditingSite, IInternetSecurityManager internetSecurityManager, BlogPostHtmlEditorControl.TemplateStrategy templateStrategy, int dlControlFlags) { // create a docked panel to host the editor Panel panel = new Panel(); panel.Dock = DockStyle.Fill; if (!BidiHelper.IsRightToLeft) panel.DockPadding.Right = 0; else panel.DockPadding.Left = 0; editorContainer.Controls.Add(panel); panel.Resize += new EventHandler(panel_Resize); if (BidiHelper.IsRightToLeft) editorContainer.RightToLeft = RightToLeft.Yes; // save references _mainFrameWindow = mainFrameWindow; _editorContainer = panel; _postEditingSite = postEditingSite; _commandManager = new CommandManager(); _userPreferencesMonitor = new UserPreferencesMonitor(); // To be high-contrast-aware we need to respond to changes in the high contrast mode // by invalidating commands, forcing the ribbon to ask us for new high contrast images. _userPreferencesMonitor.AccessibilityUserPreferencesChanged += new EventHandler(delegate (object sender, EventArgs args) { _commandManager.InvalidateAllImages(); }); _imageDecoratorsManager = new LazyLoader<ImageDecoratorsManager>(() => new ImageDecoratorsManager(components, CommandManager, GlobalEditorOptions.SupportsFeature(ContentEditorFeature.ImageBorderInherit))); _emoticonsManager = new EmoticonsManager(this, this); // initialize commands InitializeCommands(); // initialize normal editor InitializeNormalEditor(postEditingSite, internetSecurityManager, templateStrategy, dlControlFlags); // initialize source editor if (GlobalEditorOptions.SupportsFeature(ContentEditorFeature.SourceEditor)) InitializeSourceEditor(); InitializeViewCommands(); // initialize custom content InitializeContentSources(); // bring main editor panel to front (this must be here for the sidebar to work!!!!) panel.BringToFront(); }
public BlogPostEditingManager(IBlogPostEditingSite editingSite, IBlogPostEditor[] postEditors, IPublishingContext publishingContext) { // save reference to owner _mainFrameWindow = editingSite.FrameWindow; _publishingContext = publishingContext; // subscribe to weblog settings edited _editingSite = editingSite; _editingSite.GlobalWeblogSettingsChanged += new WeblogSettingsChangedHandler(editingSite_GlobalWeblogSettingsEdited); // initialize post editors _postEditors.Add(_forceDirtyPostEditor); _postEditors.AddRange(postEditors); }
internal UpdateSemanticHtmlPreviewAsyncOperation(IBlogPostEditingSite editingSite, string blogId, string[] elementIds, string templateHtml, string postBodyHtml, bool isRtl, ISynchronizeInvoke target, object previewLock, int previewImageWidth, int previewImageHeight) : base(target) { _blogId = blogId; _elementIds = elementIds; _isRtl = isRtl; _html = templateHtml.Replace(BlogEditingTemplate.POST_BODY_MARKER, postBodyHtml); _previewLock = previewLock; _previewImageWidth = previewImageWidth; _previewImageHeight = previewImageHeight; _editingSite = editingSite; }
/// <summary> /// A version of show preferences that allows the caller to specify which /// panel should be selected when the dialog opens /// </summary> /// <param name="selectedPanelType"></param> public void ShowPreferences(IWin32Window owner, IBlogPostEditingSite editingSite, Type selectedPanelType) { // Load preferences panels. LoadPreferencesPanels(); // Show the preferences form. using (new WaitCursor()) { using (PreferencesForm preferencesForm = new PreferencesForm()) { // Set the PreferencesPanel entries. for (int i = 0; i < preferencesPanelTypes.Length; i++) { // Add the entry. Type type = preferencesPanelTypes[i]; PreferencesPanel panel = Activator.CreateInstance(type) as PreferencesPanel; if (editingSite != null && panel is IBlogPostEditingSitePreferences) { (panel as IBlogPostEditingSitePreferences).EditingSite = editingSite; } preferencesForm.SetEntry(i, panel); // Select it, if requested. if (type.Equals(selectedPanelType)) { preferencesForm.SelectedIndex = i; } } // Provide a default selected index if none was specified. if (preferencesForm.SelectedIndex == -1) { preferencesForm.SelectedIndex = 0; } // Show the form. preferencesForm.Win32Owner = owner; preferencesForm.ShowDialog(owner); // if we have an editing site then let it know that the account // list may have been edited (allows it to adapt to the currently // active weblog being deleted) if (editingSite != null) { editingSite.NotifyWeblogAccountListEdited(); } } } }
public WeblogCommandManager(BlogPostEditingManager editingManager, IBlogPostEditingSite editingSite) { // save reference to editing context and subscribe to blog-changed event _editingManager = editingManager; _editingManager.BlogChanged += new EventHandler(_editingManager_BlogChanged); _editingManager.BlogSettingsChanged += new WeblogSettingsChangedHandler(_editingManager_BlogSettingsChanged); _editingSite = editingSite; BlogSettings.BlogSettingsDeleted += new BlogSettings.BlogSettingsListener(BlogSettings_BlogSettingsDeleted); // initialize commands InitializeCommands(); // initialize UI InitializeUI(); }
internal SemanticHtmlPreviewManager(IBlogPostEditingSite editingSite, TemplateHtmlDelegate templateHtmlDelegate, int width, int height) { _previewLock = new object(); _editingSite = editingSite; _templateHtmlDelegate = templateHtmlDelegate; _width = width; _height = height; string previewText = HtmlServices.HtmlEncode(Res.Get(StringId.SemanticHtmlPreviewText)); _postBodyHtml = @"<h1 {style} id=" + PreviewId_H1 + @">" + previewText + @"</h1> <h2 {style} id=" + PreviewId_H2 + @">" + previewText + @"</h2> <h3 {style} id=" + PreviewId_H3 + @">" + previewText + @"</h3> <h4 {style} id=" + PreviewId_H4 + @">" + previewText + @"</h4> <h5 {style} id=" + PreviewId_H5 + @">" + previewText + @"</h5> <h6 {style} id=" + PreviewId_H6 + @">" + previewText + @"</h6> <p {style} id=" + PreviewId_P + @">" + previewText + @"</p>"; }
/// <summary> /// A version of show preferences that allows the caller to specify which /// panel should be selected when the dialog opens /// </summary> /// <param name="selectedPanelType"></param> public void ShowPreferences(IWin32Window owner, IBlogPostEditingSite editingSite, Type selectedPanelType) { // Load preferences panels. LoadPreferencesPanels(); // Show the preferences form. using (new WaitCursor()) { using (PreferencesForm preferencesForm = new PreferencesForm()) { // Set the PreferencesPanel entries. for (int i = 0; i < preferencesPanelTypes.Length; i++) { // Add the entry. Type type = preferencesPanelTypes[i]; PreferencesPanel panel = Activator.CreateInstance(type) as PreferencesPanel; if (editingSite != null && panel is IBlogPostEditingSitePreferences) { (panel as IBlogPostEditingSitePreferences).EditingSite = editingSite; } preferencesForm.SetEntry(i, panel); // Select it, if requested. if (type.Equals(selectedPanelType)) preferencesForm.SelectedIndex = i; } // Provide a default selected index if none was specified. if (preferencesForm.SelectedIndex == -1) preferencesForm.SelectedIndex = 0; // Show the form. preferencesForm.Win32Owner = owner; preferencesForm.ShowDialog(owner); // if we have an editing site then let it know that the account // list may have been edited (allows it to adapt to the currently // active weblog being deleted) if (editingSite != null) editingSite.NotifyWeblogAccountListEdited(); } } }
private BlogPostHtmlEditor(IMainFrameWindow mainFrameWindow, Panel panelEditorContainer, IBlogPostEditingSite postEditingSite) : base(mainFrameWindow, panelEditorContainer, postEditingSite, new BlogPostHtmlEditorControl.BlogPostHtmlEditorSecurityManager(), new BlogPostTemplateStrategy(), MshtmlOptions.DEFAULT_DLCTL) { _editorContainer = panelEditorContainer; //InitializeCommandBar(commandBarDefinition); //_editorCommandBar.VerticalLineX = (BidiHelper.IsRightToLeft ? _htmlEditorSidebarHost.Right - 1 : _htmlEditorSidebarHost.Left); //_editorCommandBar.DrawVerticalLine = _htmlEditorSidebarHost.Visible; panelEditorContainer.SizeChanged += new EventHandler(editorContainer_SizeChanged); _htmlEditorSidebarHost.VisibleChanged += new EventHandler(_htmlEditorSidebarHost_VisibleChanged); CreateTabs(); InitializePropertyEditors(); ApplySpellingSettings(null, EventArgs.Empty); SpellingSettings.SpellingSettingsChanged += ApplySpellingSettings; EditorLoaded += new EventHandler(BlogPostHtmlEditor_EditorLoaded); FixCommandEvent += new FixCommendsDelegate(BlogPostHtmlEditor_FixCommandEvent); }
public DefaultSidebarControl(ISidebarContext sidebarContext, IBlogPostEditingSite postEditingSite) { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); // record the post management context and subscribe to the post list changed event _postEditingSite = postEditingSite ; // subscribe to changes that require us to re-layout the sidebar _postEditingSite.WeblogChanged +=new WeblogHandler(_postEditingSite_WeblogChanged); _postEditingSite.WeblogSettingsChanged +=new WeblogSettingsChangedHandler(_postEditingSite_WeblogSettingsChanged); _postEditingSite.FrameWindow.Layout +=new LayoutEventHandler(FrameWindow_Layout); _postEditingSite.PostListChanged +=new EventHandler(_postEditingSite_PostListChanged); ContentSourceManager.GlobalContentSourceListChanged +=new EventHandler(ContentSourceManager_GlobalContentSourceListChanged); // add the tooltip _toolTip = new ToolTip2(components); _toolTip.InitialDelay = 750 ; // set the caption Text = ApplicationEnvironment.ProductName; AccessibleName = Res.Get(StringId.SidebarPanel) ; // Turn on double buffered painting. SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); // initialize components //_weblogPanelHeader = new PanelHeader(this, WEBLOG_PANEL_CAPTION); // _weblogPanelBody = new PanelBody(); // _weblogHeader = new WeblogHeader(this, _weblogPanelBody) ; // _viewWeblogCommand = new LinkCommand(this, _toolTip, CommandId.ViewWeblog.ToString()); // _viewWeblogCommand.Name = "ViewWeblog"; // _viewWeblogAdminCommand = new LinkCommand(this, _toolTip, CommandId.ViewWeblogAdmin.ToString()); // _viewWeblogAdminCommand.Name = "ViewWeblogAdmin"; _headerControl = new SidebarHeaderControl(); _openPanelHeader = new PanelHeader(this, OPEN_PANEL_CAPTION) ; _openPanelBody = new PanelBody(); _draftsSectionHeader = new SectionHeader(this, DRAFTS_SECTION_CAPTION, SidebarColors.FirstSectionBottomColor ); _draftsPostList = new DraftPostList(this, _toolTip, DRAFTS_SECTION_CAPTION); _draftsPostList.PostSelected +=new PostEventHandler(_draftsPostList_PostSelected); _draftsPostList.PostDeleteRequested +=new PostEventHandler(_draftsPostList_PostDeleteRequested); _openDraftCommand = new LinkCommand(this, "PostHtmlEditing.Sidebar.Images.OpenPost.png", MORE_DRAFTS_CAPTION, MORE_DRAFTS_ACCNAME, _toolTip, MORE_DRAFTS_TOOLTIP, CommandId.OpenDrafts.ToString()); _recentPostsSectionHeader = new SectionHeader(this, RECENT_POSTS_SECTION_CAPTION, SidebarColors.SecondSectionBottomColor ); _recentPostList = new RecentPostList(this, _toolTip, RECENT_POSTS_SECTION_CAPTION); _recentPostList.PostSelected +=new PostEventHandler(_recentPostList_PostSelected); _openPostCommand = new LinkCommand(this, "PostHtmlEditing.Sidebar.Images.OpenPost.png", MORE_POSTS_CAPTION, MORE_POSTS_ACCNAME, _toolTip, MORE_POSTS_TOOLTIP, CommandId.OpenRecentPosts.ToString()); _insertPanelHeader = new PanelHeader(this, INSERT_PANEL_CAPTION); _insertPanelBody = new PanelBody(); _insertLinkCommand = new LinkCommand(this, "PostHtmlEditing.Sidebar.Images.InsertLink.png", INSERT_LINK_CAPTION, INSERT_LINK_ACCNAME, _toolTip, INSERT_LINK_TOOLTIP, CommandId.InsertLink.ToString()); _insertPictureCommand = new LinkCommand(this, "BlogThis.ItemTypes.Images.ImageItem.png", INSERT_PICTURE_CAPTION, INSERT_PICTURE_ACCNAME, _toolTip, INSERT_PICTURE_TOOLTIP, CommandId.InsertPictureFromFile.ToString()); ContentSourceInfo csi = ContentSourceManager.GetContentSourceInfoById(PhotoAlbumContentSource.ID); if (csi != null) { _insertPhotoAlbumCommand = new LinkCommand(this, csi.Image, String.Format(CultureInfo.CurrentCulture, Res.Get(StringId.PluginInsertSidebarText), csi.InsertableContentSourceSidebarText), String.Format(CultureInfo.CurrentCulture, Res.Get(StringId.PluginInsertSidebarText), csi.InsertableContentSourceSidebarText), _toolTip, null, PhotoAlbumContentSource.ID); } ContentSourceInfo csi2 = ContentSourceManager.GetContentSourceInfoById(WebImageContentSource.ID); if (csi2 != null) { _insertWebImage = new LinkCommand(this, csi2.Image, String.Format(CultureInfo.CurrentCulture, Res.Get(StringId.PluginInsertSidebarText), csi2.InsertableContentSourceSidebarText), String.Format(CultureInfo.CurrentCulture, Res.Get(StringId.PluginInsertSidebarText), csi2.InsertableContentSourceSidebarText), _toolTip, null, WebImageContentSource.ID); } _insertTableCommand = new LinkCommand(this, "Tables.Commands.Images.CommandInsertTableCommandBarButtonBitmapEnabled.png", INSERT_TABLE_CAPTION, INSERT_TABLE_ACCNAME, _toolTip, INSERT_TABLE_TOOLTIP, CommandId.InsertTable.ToString()); _contentInsertCommands = new ContentInsertCommands(this, _toolTip, LINK_COMMAND_PADDING, int.MaxValue); _separator2 = new SeparatorControl(); Controls.Add(_separator2); Controls.Add(_headerControl); UpdatePostLists() ; }
public DefaultSidebar(IBlogPostEditingSite postEditingSite) { _postEditingSite = postEditingSite ; }
public static BlogPostHtmlEditor Create(IMainFrameWindow mainFrameWindow, Control editorContainer, IBlogPostEditingSite postEditingSite) { Panel panelBase = new Panel(); panelBase.Dock = DockStyle.Fill; editorContainer.Controls.Add(panelBase); return new BlogPostHtmlEditor(mainFrameWindow, panelBase, postEditingSite); }
public RecentItemsCommand(IBlogPostEditingSite postEditingSite) : base(CommandId.MRUList) { this.postEditingSite = postEditingSite; ExecuteWithArgs += new ExecuteEventHandler(RecentItemsCommand_ExecuteWithArgs); }
public static BlogPostHtmlEditor Create(IMainFrameWindow mainFrameWindow, Control editorContainer, IBlogPostEditingSite postEditingSite) { Panel panelBase = new Panel(); panelBase.Dock = DockStyle.Fill; editorContainer.Controls.Add(panelBase); return(new BlogPostHtmlEditor(mainFrameWindow, panelBase, postEditingSite)); }
private void InitializeNormalEditor(IBlogPostEditingSite postEditingSite, IInternetSecurityManager internetSecurityManager, BlogPostHtmlEditorControl.TemplateStrategy templateStrategy, int dlControlFlags) { // configure editing options _mshtmlOptions = new MshtmlOptions(); _mshtmlOptions.UseDivForCarriageReturn = GlobalEditorOptions.SupportsFeature(ContentEditorFeature.DivNewLine); // Commented out for now to prevent first chance exception //_mshtmlOptions.EditingOptions.Add(IDM.RESPECTVISIBILITY_INDESIGN, GlobalEditorOptions.SupportsFeature(ContentEditorFeature.HideNonVisibleElements)); _mshtmlOptions.EditingOptions.Add(IDM.AUTOURLDETECT_MODE, false); _mshtmlOptions.EditingOptions.Add(IDM.MULTIPLESELECTION, false); _mshtmlOptions.EditingOptions.Add(IDM.LIVERESIZE, true); _mshtmlOptions.EditingOptions.Add(IDM.KEEPSELECTION, true); _mshtmlOptions.EditingOptions.Add(IDM.DISABLE_EDITFOCUS_UI, true); _mshtmlOptions.DLCTLOptions = dlControlFlags; _mshtmlOptions.DocHostUIOptionKeyPath = GlobalEditorOptions.GetSetting<string>(ContentEditorSetting.MshtmlOptionKeyPath); // create the editor _normalHtmlContentEditor = new BlogPostHtmlEditorControl(_mainFrameWindow, StatusBar, _mshtmlOptions, this, this, this, new SmartContentResizedListener(ResizedListener), new SharedCanvasImageReferenceFixer(ReferenceFixer), internetSecurityManager, CommandManager, templateStrategy, this); _normalHtmlContentEditor.PostBodyInlineStyle = GetPostBodyInlineStyleOverrides(); // hookup services and events _normalHtmlContentEditor.HtmlGenerationService = new HtmlGenerator(this); _normalHtmlContentEditor.DataFormatHandlerFactory = new ExtendedHtmlEditorMashallingHandler(_normalHtmlContentEditor, this, this, postEditingSite as IDropTarget); _normalHtmlContentEditor.DocumentComplete += new EventHandler(htmlEditor_DocumentComplete); _normalHtmlContentEditor.GotFocus += htmlEditor_GotFocus; _normalHtmlContentEditor.LostFocus += htmlEditor_LostFocus; _normalHtmlContentEditor.SelectedImageResized += new SelectedImageResizedHandler(_normalHtmlContentEditor_SelectedImageResized); _normalHtmlContentEditor.UpdateImageLink += new UpdateImageLinkHandler(_normalHtmlContentEditor_UpdateImageLink); _normalHtmlContentEditor.HtmlInserted += new EventHandler(_normalHtmlContentEditor_HtmlInserted); _normalHtmlContentEditor.HelpRequest += new EventHandler(_normalHtmlContentEditor_HelpRequest); _normalHtmlContentEditor.EditorControl.AccessibleName = "Editor"; _normalHtmlContentEditor.KeyboardLanguageChanged += new EventHandler(_normalHtmlContentEditor_KeyboardLanguageChanged); _normalHtmlContentEditor.TrackKeyboardLanguageChanges = true; // initialize the sidebar _htmlEditorSidebarHost = new HtmlEditorSidebarHost(_normalHtmlContentEditor); _htmlEditorSidebarHost.Dock = !BidiHelper.IsRightToLeft ? DockStyle.Right : DockStyle.Left; _htmlEditorSidebarHost.Width = Res.SidebarWidth; if (BidiHelper.IsRightToLeft) { _htmlEditorSidebarHost.RightToLeft = RightToLeft.Yes; BidiHelper.RtlLayoutFixup(_htmlEditorSidebarHost); } _editorContainer.Controls.Add(_htmlEditorSidebarHost); _htmlEditorSidebarHost.BringToFront(); _htmlEditorSidebarHost.VisibleChanged += _htmlEditorSidebarHost_VisibleChanged; // register sidebars _htmlEditorSidebarHost.RegisterSidebar(new DisabledContentSourceSidebar(this)); _htmlEditorSidebarHost.RegisterSidebar(new BrokenContentSourceSidebar(this)); _htmlEditorSidebarHost.RegisterSidebar(new ContentSourceSidebar(this)); _htmlEditorSidebarHost.RegisterSidebar(new ImagePropertiesSidebar(_normalHtmlContentEditor, this, new CreateFileCallback(CreateFileHandler))); _htmlEditorSidebarHost.AccessibleName = "Sidebar"; // register the normal editor RegisterEditor(_normalHtmlContentEditor); }