Pete Writes: Beardy weirdies

That sound you can hear is one hand clapping

2006-02-18Hacking jEdit for fun and productivity / changing the scrolling

0 comments

Tags All Tech

I've never compiled anything, and am about to learn. Necessary prerequisites for this (well, for me anyway) are several pints of tea and no sleep... which will also have to serve as an apology for the rambling tone of this walk-through... oh, and I should probably mention I'm doing this under Windows...

AIM OF THE CHANGES:

To modify the default behaviour of jEdit so that the scrollwheel on my mouse scrolls a page of text, and thus remove the need for me to (remember to) hold down shift to accomplish that task in the application.

NECESSARY CHANGES:

You only need to edit one file. After grabbing and unzipping the source code, this will probably either be:

*\jedit42source\jEdit\org\gjt\sp\jedit\Java14.java

or

*\jedit43pre3source\jEdit\org\gjt\sp\jedit\textarea\JEditTextArea.java

As for the edit, all you need to do is switch the routine invoked if isShiftDown() with the one that mentions "3 * e.getWheelRotation()" — this section is around two hundred lines into the source. I'm not going to add too much explanation, because if you're actually bothering to read this, chances are you just wanted a pointer to the correct file to edit and some idea of what to do next...

WHAT TO DO NEXT:

First we'd better grab a Java compiler... such as the one with this package:

http://java.sun.com/j2se/1.5.0/download.jsp

The version without NetBeans works fine and is about 60Mb. Install it, minus the optional extras, which will still be a fairly hefty chunk of disk space for people like me whose minds reside in the 90s, but bear in mind you can always uninstall it straight afterwards...

We'll now defer to some extremely useful instructions by jgellene that point out we can use jEdit as a development environment to build jEdit:

http://community.jedit.org/?q=node/view/280

...and indeed we can. It's a bit easier than the explanation suggests: the way to do it is to first install the Ant Farm plugin mentioned (which seems to include the Console one.) Then launch jEdit on top of the javaw.exe supplied in the JDK (Java Development Kit) rather than the JRE (Java Runtime Environment) one you likely installed back when you just wanted to run Java apps rather than compile them — the easiest way to do this is to copy your existing jEdit shortcut, then point the path to javaw.exe towards the SDK /bin/ directory. You can then follow the rest of the instructions about opening the build.xml for the jEdit source you're working with inside the Ant Farm plugin, proceeding to execute "dist" and build, which should get you the new jedit.jar you wanted. With default page-at-a-time scrolling.

Now, is there any chance of scrolling being added as a tickbox or config file option in a future version of jEdit, I wonder? This is a touch convoluted for the average user.


ADD COMMENT

Tags All Tech