Now that Padre is running fast enough to well and truly keep up with my typing, I'm making another attempt to switch over and make Padre my primary editor.
As a result, I've been forced into implementing one of my shop-stopper features.
"Single Instance" support is a fairly common feature in major applications which keeps only one instance of the application running, and causes new invocations to communicate with the primary instance and open any files in the existing one, instead of spawning a new instance.
It seems simple, but implementing it involves implementing a Wx::Socket-based server inside of Padre (so that it can run in the main thread), writing a protocol for two Padre instances to talk to each other and communicate commands, and then writing a client for it into the startup sequence of Padre that talks to the server, all in a way that doesn't block for long periods of time.
To enable single-instance mode, set the flag main_singleinstance: 1 in your config.yml (by hand in the short term).
Once enabled, it should become much simpler to integrate Padre into other applications as an "external editor" so that double clicking in your version control gui or anything else that supports editor integration does the expected thing and just loads the specified file in the current Padre instance.
With single instance support out of the way, now I only need to get recursive find and replace working, and there should be no reasons left to go back to Ultraedit any more.
Single instance support should appear on the CPAN in Padre 0.35.
Re:Great Job.
Alias on 2009-05-07T06:51:11
It does that too.
An example of the command stream from the child to the server is
open C:\project\Makefile.PL
open C:\project\lib\Foo.pm
focusThe last command is sent even if there's no files to open, and triggers the single instance into bringing itself to the foreground.
Re:How about using wxSingleInstanceChecker?
Alias on 2009-05-07T06:53:05
That's not really what I was looking for...
I'd just prefer to go straight to hitting a localhost port.
Re:a suggestion
tsee on 2009-05-07T14:06:58
It's already there.
I think the ack support could do with some spit and polish, but it's been part of the editor for a long time. It *should* be a plugin, though.
I'm a little dubious
Alias on 2009-05-07T23:51:23
Although I appreciate ack, I'm not entirely sure if deep integration is worth it.
It mainly hinges on how well we can deal with callbacks from Ack back into Padre, and whether the search parameter set up is clean enough.
I've just published the bindings for libunique to CPAN this week (Gtk2::Unique). Libunique doest exactly what you need but it works only with Gtk2 and through D-Bus (although it can default to use sockets if D-Bus is not present). This dependencies make it almost Linux/Unix exclusive. It's a pity that you can't reuse it for your project as it would have saved you a lot of troubles.
Perhaps you could do something similar to what libunique does and provide a framework and a separate module for other wx applications? I'm sure that a lot of people would appreciate it.