Posts Tagged live writer

Another dip into Writer Plug-in Development


Introduction

This post continues my exploration of the possibilities that Writer plug-in offer. These are the previous blog posts on the topic:

What I think I try and build this time

This time I’m going to go for something a bit smarter. There are couple of thing things that I think I build into a plug-in.

  1. A Wikipedia Link which looks some thing like    Wikipedia iconWikipedia Link (there is a bit of work to do on the icon/image).
    1. The plug-in will take the currently selected text
    2. If the selection exists on the Wikipedia simply insert the link
    3. (Version 2) I think I’ll allow some degree of customisation of the link inserted.
    4. (Version 2) Will allow for the pasting of a citation (Version 3 allows for multiple formats).
  2. RSS Feed Linking, or Blog This from a RSS feed. Or, could be a citation type of to an article.New Scientist is my first target for this but the list of possible RSS feeds will probably grow.
    1. (Version 3) There is probably a generalisation which will fall out of this, which should allow for the linking to any RSS feed,
    2. There will also, probably fall out, a set of  patterns for the link and citation
  3. MSDN Link (with the look like point 1).
  4. (Version 3) Other reference sites, dictionaries, thesauri, quotes, (and more).

Time table

Wait and see. I’m not certain how much time I will have for the project. It will be a bit of a puddle around when the mood takes me project.

del.icio.us Tags: ,,
Digg This
Advertisements

, ,

Leave a comment

Building a Font Setting Plug-in – Part 3


Introduction

This may well be the last post in this series. I have a basically working plug-in, after finding a few things (which I will cover in more detail below):

  1. couple of interesting features,
  2. something which needs to be implemented (overridden),
  3. a useful tool for looking under the covers at a .net assembly,
  4. a very useful fragment of code for XML escaping a text string,
  5. and brushing up my skills with WinForms.

Interesting Features

  1. The text inserted by the plug-in is not spelling checked. This for me makes the plug-in next door to useless. Not sure if I can work a way around this feature. I’ll have a bit of an explore I think I’ve seen checking switch on for other inserted content (yes the code window below is spelling checking). So, this may not be the last in the series. Time for some more digging into the Writer API.
  2. The Settings property is an interesting beast. The setting are persisted directly, which makes it interesting getting cancel buttons to ignore what has been happening. I’ve ended up passing Font and Color objects around, and only persisting the values out of them when I have an OK which gets the program to to main (plug-in) level.

Override Required

The GenerateEditorHTML needs to be overridden. This is the method which gets called in the content in the side bar is changed.

public override string GenerateEditorHtml(ISmartContent content, IPublishingContext publishingContext)
{
   return BuildHTML(content, publishingContext);
}

Useful Tool – IDLASM

This is one which I found when trying to sort out the GIF file not found problem. The big feature for me at that time was dumping (into a window) the manifest on the assembly. There are bound to be lots of other reasons to pull this tool out.

XML Escaping.

This one is courtesy of the post on Stack Overflow – string escape into XML. A very simple to get all those &lt an the like into your string (which is going to be html (or xml).

, , , ,

Leave a comment

Building A Font Setting Pluggin – Part 2


Gremlins

XCOPY return code 4

Error 1 The command "XCOPY /D /Y /R "c:userscraigdocumentsvisual studio 10ProjectsFontSettingPluginFontSettingPluginbinDebugFontSettingPlugin.dll" "C:Program FilesWindows LiveWriterPlugins"" exited with code 4. FontSettingPlugin

From the command line the response if “access denied”.

Then the “penny dropped”, Vista UAC is the problem. A quick bit of Setting the Security on the directory, and fixed.

Loading Writer – Cannot Find my GIF.

This one has taken some time to fix. A couple of elements in the solution.

    namespace craigwatson1962.spaces.live.com.FontSettingPlugin

    My predilection to use a a namespace which is unique, hence avoiding namespace collisions, was part of the problem.

    I need to set the project default namespace. Project Properties.
    VS_DefaultNameSpace 
    Getting the gif file bound into the output assembly. Make sure you have the properties set correctly (Build Action and Namespace – being the most important:
    VS_Embedded_Gif

The the code which links all the bits together (note the use of the “full stops” in location, and the case sensitivity [would appear to be case sensitive]).

[WriterPlugin("FFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFFF",  
        "Font Setting Plugin", 
        Description="Sets the font for the currently selected text",
        HasEditableOptions=true,
        ImagePath = "Resources.FontIcon.gif",
        Name="Font setting plugin",
        PublisherUrl="http://craigwatson1962.spaces.live.com")]

 

, , , , , ,

Leave a comment

%d bloggers like this: