Email: info at xpro.com.au
Phone: +61 3 9479 3988 (Don) +61 0425 784 187(Paul)
Fax: +61 3 9479 1675
Street/Postal:
Suite 3B La Trobe R&D Park,
2 Research Ave, Bundoora Vic 3083, Australia

CodeJumper for Delphi v1.01

10 Feb 2003
I have had a bug report related to the D6 binary included in version 1.01. As a temporary fix, you may want to download the previous version, 1.0

Version 1.01 Download (394Kb) Updates & Support
This Delphi 5-7 plug-in implements a keymapping enhancement module, extending the functionality of the IDE editor for .PAS,.DPR and .DPK files. It provides block-end matching for Object Pascal block statement constructs - toggling the cursor position from anywhere to either end of the enclosing block, or highlighting the enclosing block. Block statement boundaries are matched instances of keyword end with the ObjectPascal keyword at the opposite end of the block (asm, begin, case, class, interface, library, package, record, try, unit). The overloaded keywords case, class and interface are ignored in their other contexts.

It also provides cyclic jumps between all uses clauses and the current position, and cyclic jumps to the interface, implementation, initialization, finalization sections and the current position.

The current position is automatically bookmarked before any of these jumps or toggles, and can be revisited even after subsequent editing at the jump location.

Invocation on syntactically incomplete or incorrect files will generate tool messages in the IDE's MessageView.

Installation

After downloading, run this self-extracting setup program.

You have the choice of installing for any combination of Delphi 5, 6 and 7. The binary package will be installed in $(DELPHI)\Projects\Bpl, and the README, licence and source code for the package will be installed under the directory you choose in the setup program. The setup program makes a registry entry in Delphi's design-time package list, so the wizard will be active the next time you (re)start Delphi.

I don't think there should be any problems compiling this package in Kylix, I just haven't got around to it. I would like to hear of your experience if you go down this route...

This wizard makes use of OpenTools API features only available in Delphi 5 or later, so can't be compiled for earlier versions of Delphi.

Keybindings
Ctrl+B
acts as a toggle.
The first press will select all the minimally enclosing block statement for the current cursor position. The second press unselects the block and restores the previous cursor position.
Ctrl+[
acts as a toggle.
The first press will move the cursor from current position to the start of the minimally enclosing block statement. The second press restores the previous cursor position.
Ctrl+]
acts as a toggle.
The first press will move the cursor from current position to the end of the minimally enclosing block statement. The second press restores the previous cursor position.
Ctrl+I Repetitive presses cycles through: interface, implementation, initialization, finalization sections, current position.
Ctrl+U Repetitive presses cycles through: interface uses clause,implementation uses clause, current position
Ctrl+Shift+B Moves the text cursor back to its position before any of the jump or toggle keystrokes
Changing the keybindings

I have taken pains to produce a relatively unused and hopefully logical set of keybindings for this Wizard. There are potential clashes with the IDE on Ctrl+B (Buffer list demo popup) and the Default and Classic keyboard mappings on Ctrl+I (insert TAB).

However, if you want to reassign the keybindings, the source code is included along with the wizard. Modify the method TCodeJumpWizard.BindKeyboard in the file XPCodeJumpWizard.pas. Compile and install the Delphi package (.DPK file). I am assuming you are using the default package output directory, $(DELPHI)\Projects\Bpl, so the recompiled package will overwrite the package installed by the setup program. Otherwise, the new package will not install because of unit name clashes with the existing package.

Having said all that, some words of caution....

  • Most of the common combinations are already taken for the Default and Classic keyboard mappings, so you may be masking exisiting IDE behaviour.
  • Similarly, watch out for menu and OS shortcuts.
  • Also watch out for other installed packages with keybinding modules. Look in Tools|Editor Options...|Key Mappings|Enhancement Modules to see what's installed. These modules have a top to bottom precedence order for IDE keystrokes, so reorder the list (via the MoveUp and MoveDown buttons) or disable modules if you aren't getting your desired keystroke behaviour.
  • Most punctuation keys have no virtual key code, and in my experience their ordinal values don't work with Menus.ShortCut().
  • Note that some keystroke combinations either don't bind or cause Delphi to AV, usually when the package is loaded or unloaded. As a general rule, avoid using the Alt key in combinations.
  • For examples have a look at the method TClassicBinding.BindKeyboard() in $(DELPHI)\Demos\ToolsAPI\Editor Keybinding\BufferList.pas

Copyright © 2001-2003, The Excellent Programming Company