PyPN Script Repository

May 13th, 2009

Like the idea of using Python scripts to enhance Programmer’s Notepad but not sure where to start? James Yoneda has created the awesome ScriptShare website for exactly this purpose:

Scriptshare in Google Chrome

Scriptshare in Google Chrome

There are a bunch of scripts already there, and hopefully you will add yours too! We’re working on getting this moved over to pnotepad.org eventually.

My thanks to James for putting this effort in and creating such a useful site in such short time!

Simon PN, PyPN, python

PyPN 0.10.973 Released

May 13th, 2009

I’m happy to announce a minor bug fix release for PyPN, the Python extension for Programmer’s Notepad. This release fixes a PN crash if you tried to create a Scintilla object with no active document, and also the exception syntax problem preventing PyPN from working in Python 2.4-2.5.

Downloads

Simon PN, PyPN, python

Programmer’s Notepad 2 0.9.970 Released

May 12th, 2009

The latest testing release of Programmer’s Notepad is out. This is a minor release with a few important bug fixes, including Unicode file handling, Windows 7 RC quirks, and a couple of toolbar appearance issues. All testing release users should upgrade to this new build.

Downloads

Thanks to all the users who have put time and effort into reporting and following up on bugs, testing, and contributing patches.

Simon PN

Programmer’s Notepad 2 0.9.962 Released

May 2nd, 2009

The latest testing release of Programmer’s Notepad is out. This release brings a whole bunch of great changes: Script (macro) recording when using PyPN, a customizable toolbar, firefox-style tab ordering and smart highlight. There are also a load of bug fixes too.

Downloads

There is also a new PyPN release fixing a couple of issues with the included scripts from the last build:

Thanks to all the users who have put time and effort into reporting and following up on bugs, testing, and contributing patches.

Simon PN, PyPN

links for 2009-04-15

April 15th, 2009

delicious links

links for 2009-04-04

April 4th, 2009

First Poll Results

March 10th, 2009

A little while back I asked people a couple of questions to help guide future PN development.

The results ended up looking like this:

Is the fact that you can float PN document windows useful?

This question is concerned with whether the MDI window management system is helpful to people. I suspected that most users had windows maximised all the time and used the tabs to switch – i.e. MDI wasn’t buying them much. Here are the results:

Results of MDI Poll

18% of people were using the abilities of MDI windows and were very happy about them. Pretty much everyone else doesn’t care or would rather be able to split the view.

Don’t worry, this isn’t going to drive any instant knee-jerk changes, but I’m keeping it in mind for future design work. I am definitely going to address the lack of split views, I’m just trying to decide how.

Do you use the individual output windows?

Here I wondered whether the hidden away option to use individual output windows instead of the global one for each window was actually being used – I suspected not. I was wrong!

Individual Output Poll Results

Lots of people use the individual output windows, and it appears lots of people have no idea what output windows are! I’m not sure whether this is because they have no need in their editing for tools and output, or are just unaware of the features.

I’ll be posting some more questions soon, and wanted to thank everyone who took the time to answer these polls or comment – it’s appreciated!

Simon PN

links for 2009-02-21

February 21st, 2009

Programmer’s Notepad 2 0.9.926 Released

February 19th, 2009

This is a minor bugfix testing release for Programmer’s Notepad, fixing a few niggles with the last release.

Downloads

There is also a new PyPN release fixing a couple of issues with the included scripts from the last build:

Thanks to all the users who have put time and effort into reporting and following up on bugs, testing, and contributing patches.

Simon PN

Adding a Menu Item from Your Extension

February 17th, 2009

This is the second post in the Writing your First Extension series. You can see the full article here: Writing Your First Extension.

Menu items are added via the IPN object provided at extension load time. You add menu items by providing an implementation of IMenuItems. Here is a very simple implementation supporting a single item:

class Menu : public extensions::IMenuItems
{
public:
    Menu()
    {
        memset(&item1, 0, sizeof(item1));
        item1.Handler = &MyExtensionFunc;
        item1.Title = L"Hello World";
        // item1.Type = extensions::miItem;
        // item1.UserData = 0;
    }

    /**
     * Get the number of MenuItem instances that can be retrieved.
     */
    virtual int GetItemCount() const
    {
        return 1;
    }

    /**
     * Get an individual MenuItem instance by index.
     */
    virtual extensions::MenuItem& GetItem(int index) const
    {
        if (index == 0)
            return const_cast<extensions ::menuitem&>(item1);
    }

private:
    extensions::MenuItem item1;
};

This very simple implementation adds a single menu item called "Hello World". When the item is selected, the MyExtensionFunc method will be executed by PN.

It might seem like a fair bit of code to add a menu item, but in the next SDK version I’ll provide a general-purpose helper to make this easy. The reason for the interface is to make it easy for you to provide sub-menus. MenuItem instances can contain child items by changing Type to miSubItem and filling in the SubItems member with another instance implementing IMenuItems.

The handler method looks like this:

void MyExtensionFunc(extensions::cookie_t /*cookie*/)
{
    g_PN->GetGlobalOutputWindow()->AddToolOutput("Hello World!");
    g_PN->ShowOutput();
}

Once you have your handler and IMenuItems implementation, you just need to tell PN about your items. In your init function you need something like this:

bool __stdcall pn_init_extension(int iface_version, extensions::IPN* pn)
{
    if(iface_version != PN_EXT_IFACE_VERSION)
        return false;

    g_PN = pn;

    Menu menu;
    pn->AddPluginMenuItems(&menu);

    return true;
}

Now you have Programmer’s Notepad presenting your commands in the menu and can handle their selection. Next time we’ll look at the other events PN lets you attach to.

Simon PN