NAME

Padre - Perl Application Development and Refactoring Environment

SYNOPSIS

Padre is a text editor aimed to be an IDE for Perl.

You should be able to just type in

padre

and get the editor working.

While I have been using this editor since version 0.01 myself there are still lots of missing features.

Not only it is missing several important feature, everything is in a constant flux. Menus, shortcuts and the way they work will change from version to version.

Configuration options are also changing which means if you configure it in one version you might need to configure it again.

Having said that you can already use it for serious editing and you can even get involved and add the missing features.

You should also know that I am mostly working on Linux and I have been using vi for many years now. This means that I am not that familiar with the expectations of people using Windows.

Getting Started

After installing Padre you can start it by typing padre on the command line. On Windows that would be Start/Run padre.bat

(TODO) By default Padre starts with an editor containing a simple Perl script and instructions.

You can edit the file and save it using File/Save (Ctrl-S).

You can run the script by pressing Run/Run Script (F5)

You can start new files File/New (Ctrl-N) or open existing files File/Open (Ctrl-O).

By default Padre uses the same perl interpreter fo executing code that it uses for itself but this will be configurable later.

FEATURES

Instead of duplicating all the text here, let me point you to the web site of Padre http://padre.perlide.org/ where we keep a list of existing and planned features.

DESCRIPTION

Configuration

The application maintains its configuration information in a directory called .padre.

Files operations

File/New creates a new empty file. By default Padre assumes this is a perl script. (TODO later this default will be configurable).

File/Open allows you to browse for a file and select it for opening.

File/Open Selection, (Ctrl-Shift-O) if there is a selected text this will try to locate files that match the selection. If the selection looks like a path Padre will try to open that path either absolute or relative. If it looks like a module name (Some::Thing) it will try to find the appropriate file Some/Thing.pm in @INC and open it. currently this feature opens the first file encountered. (TODO it should find all the possibilities and if there are multiple hits offer the user to choose. This will be especially important if we are working on a module that is also already installed. Padre might find the installed version first while we might want to open the development version.)

(TODO: when the file is not of perl type we should have other ways to recognize files from internal naming and have pathes to search. Surprise, not every language uses @INC.)

File/Close - checks if the file is saved, if it is closes the current tab.

File/Close All - closes all opened files (in case they are not saved yet ask for instructions).

File/Close All but Current - closes all opened files except for the currently being edited.

File/Reload File - Reloads the file. This is interesting if you either made changes and want to discard them and/or if the file has changed on the disk. If there are unsaved changes Padre will ask you if you really want to throw them away. (TODO: make a backup of the file before discarding it)

File/Save Ctrl-S - save the current file. If the buffer is not yet saved and has no filename associated with it, Padre will ask you for a filename.

File/Save As - Offer the user to select a new filename and save the content under that name.

File/Save All - Save all the currently opened files.

File/Convert - Convert line endings to Windows, Unix or Mac Classic style. (TODO stop the autoconversion of mixed files, just report them.)

Files/Recent Files - a list of recently opened files to open them easily. (TODO: update the list when we open a file, not only when opening padre) (TODO: allow the user to configure size of history)

File/Doc Stats - just random statistics about the current document. (TODO: If you miss anything important let us know!)

File/Quit - Exits Padre.

Simple editing

The simple editing features (should) provide the expected behavior for Windows users.

Edit/Undo Ctrl-Z

Edit/Redo

Edit/Select All Ctrl-A , select all the characters in the current document

Edit/Copy Ctrl-C

Edit/Cut Ctrl-X

Edit/Paste Ctrl-V

(TODO What is Ctrl-D ?, duplicate the current line?)

Mouse right click

Click on the right button of the mouse brings up a context sensitive menu. It provides the basic editing functions and will provide other context sensitive options.

Projects (TODO)

Padre will have the notion of a Perl project. As we would like to make things as natural as possible for the perl developer and we think the distribution methods used for CPAN module are a good way to handle any project Padre will understand a project as a CPAN module. This does not mean that your project needs to end up on CPAN of course. But if your projects directory structure follows that of the modules on CPAN, Padre will be automatically recognize it.

Module::Starter

As a first step in the direction of supporting CPAN-style perl projects we integrated into Padre the use of Module::Starter

File/New.../Perl Distribution will bring up a dialog box where you can select some of the parameters your new project has such as Name of the Project (e.g. My::Widgets), Author - that is probably your name, e-mail (your e-mail).

Builder is the tool that you project is going to use to package itself and then your user will use to install the project. Currently Module::Build and ExtUtils::MakeMaker are supported. (TODO add Module::Install as well).

License is one of the keywords currently listed in the META.yml spec of Module::Build. (TODO: update the list or make it dynamic)

Once you click OK, Module::Starter will create a new directory called My-Widgets in the parent directory you selected in the last field.

Other

On Strawberry Perl you can associate .pl file extension with C:\strawberry\perl\bin\wxperl and then you can start double clicking on the application. It should work...

Run This (F5) - run the current buffer with the current perl
this currently only works with files with .pl  extensions.

Run Any (Ctr-F5) - run any external application
First time it will prompt you to a command line that you have to
type in such as

perl /full/path/to/my/script.pl

...then it will execute this every time you press Ctrl-F5 or the menu option. Currently Ctrl-F5 does not save any file. (This will be added later.)

You can edit the command line using the Run/Setup menu item.

Bookmarks

View/Set Bookmark (Ctrl-B) brings up a window with a predefined text containing the file name and line number (TODO should be the content of the current line).

View/Goto Bookmark (Ctrl-Shift-B) brings up a window with the list of available bookmarks. You can select one and press OK to jump to that location. If the file where the bookmark belongs to is not open currently, it will be opened and the cursor will jump to the desired place.

In both cases while the window is open you can select existing bookmarks and press the Delete button to remove the selected one or press Delete All to remove all the existing bookmarks.

Ctr-1          matching brace
Ctr-P          Autocompletition
Alt-N          Nth Pane
Ctr-TAB        Next Pane
Ctr-Shift-TAB  Previous Pane
Alt-S          Jump to list of subs window

Ctr-M Ctr-Shift-M  comment/uncomment selected lines of code

Ctr-H opens a help window where you can see the documentation of
any perl module. Just use open (in the help window) and type in the name
of a module.

Ctr-Shift-H Highlight the name of a module in the editor and then
press Ctr-Shift-H. IT will open the help window for the module
whose name was highlighted.

In the help window you can also start typing the name of a module. When the
list of the matching possible modules is small enough you'll be able
to open the drop-down list and select the name.
The "small enough" is controled by two configuration options in the
Edit/Setup menu:

Max Number of modules
Min Number of modules

This feature only works after you have indexed all the modules
on your computer. Indexing is currently done by running the following command:

padre --index

Rectangular Text Selection

Simple text editors usually only allow you to select contiguous lines of text with your mouse. Somtimes, however, it is handy to be able to select a rectangular area of text for more precise cutting/copying/pasting or performing search/replace on. You can select a rectangular area in Padre by holding down Ctr-Alt whilst selecting text with your mouse.

For example, imagine you have the following nicely formatted hash assignment in a perl source file:

 my %hash = (
     key1 => 'value1',
     key2 => 'value2',
     key3 => 'value3',
);

With a rectangular text selection you can select only the keys, only the values, etc..

Syntax highlighting

Padre is using Wx (aka wxPerl), wxWidgtes for GUI and Scintilla for the editor. Scintiall provides very good syntax highlighting for many languages but Padre is still bound by the version of Scintilla included.

The share/styles/default.yml file is the mapping between the Scintialla defined constants for various syntactical elements of each language and the RGB values of the color to be used to highlight them.

We plan to allow the user to switch between styles.

Adding new syntax highlighting

Need to define constants in Padre::Util to be in the Padre::Constant namespace.

Need to add the color mapping to share/styles/default.yml

Need to implement the Padre::Document::Language class.

Need to define the mime-type mapping in Padre::Document

For examples see Padre::Document::PASM, Padre::Document::PIR, Padre::Document::Perl.

Syntax checking

Depending on a corresponding support in the respective Padre::Document::Language class, Padre supports real time syntax checking capabilities:

  • Syntax errors or warnings are displayed in a side bar (usually at the bottom of the Padre window). By double-clicking a list entry you can navigate to the position in the file.

  • Additionally, there is a symbol column on the left side of the editor where colored symbols mark the code lines with problems.

WARNING NOTE

Syntax checking for Perl5 documents comes bundled with Padre. It is implemented using "perl -c". This means that parts of the code actually get executed (e.g. BEGIN blocks). Malicious software might used this fact to damage your system (BEGIN { system('rm -rf ~') }) or suck up your resources (BEGIN { while(1) { } }). Syntax checking is currently disabled by default and has to be enabled manually after every start of Padre. This somewhat increases security when doing padre some_unknown_file.pl. However, it does not protect you when you open a file from within Padre while syntax checking is turned on. The most secure solution would require a really fast non-executing syntax checker which unfortunately is currently not available.

Preferences

There are several types of preferences we can think of. There are the current view orinted preferences such as Show newlines or Show Line numbers and there are the project and file oriented preferences such as the use of TAB or whitespace for indentation.

We would like to achive that the

Currently some of the preferences are accesible via the Edit/Preferences menu options, others via the View menu option.

We have to make sure that when changing the preferences via the GUI it change for the correct things.

e.g. When changing the Use TABs preference it currently applyes to all the files open currently or in the future. It should probably apply to the current file and/or the current project. Such options - when changing them - might even be applied "retroactively". That is when I change the TAB/space mode of a file or a project it should ask if I want to reflow the file with the new method of indentation?

On the other hand the "TAB display size" is purely a local, edior oriented preference. It should probably apply to all files currently open.

There are other aspects of preferences as well that might not exactly overlap with the above set:

The developer might work on the same project on different machines. In such case some of the personal preferences should apply only only on one computer while others apply in both places.

In particular if Padre is installed in a Portable Perl it might run on machines with different parameters. Screen size and resolution might be different along other parameters. We would like to make sure the relevant preferences are separated from those that are constant even when moving betwen computers.

Editor or view oriented preferences

Size and location of windows
Show/Hide various windows, Status bar, Toolbar
Files recently opened
Files that were open last time, cursor location
Show newlines
Show Line numbers
Show indentation guide

View/Show Indentation Guide

When set, Padre will display a thin vertical line at every indentation level on every row with are indented more than one level.

Highlight indentation guide (TODO)

This should be a separate option available only if the Show indentation guide and brace matching is on.

If SetHighlightGuide is set to 8 then when the user reaches one side of a pair of praces the indentation guide - if there is one on column 8 - will be highlighted. (in green).

As I understand Padre should constantly adjust the SetHighlightGuide so that in every block the "correct" indentation guide is highlighted.

Show Call Tips
TAB display size
Allow experimental features

In order to allow the experimental features one needs to manually turn on the experimental flag to 1 in config.yml. As Padre keeps overwriting this file you'll have to make this change with another editor and while Padre is not open.

The config.yml file is in ~/.padre/ on Linux/Unix and in general in your home directory on Windows. In any case the Help/About box will show you the path of the .padrfe directory of Padre.

Once you set the experimental flag when you start Padre you will see a new menu on the right side of the menu bar called Experimental.

Open file policy

What files to open when launchin Padre? nothing, new, those that were open last time?

Max/Min number of modules to display in podviewer
Autoindentation

Possible values: no/same level/deep

There are at least two levels of autoindentation:

1) when ENTER is pressed indent to exactly the same level as the previous line

2) if there is an opening brace { on the previous line, indent one level more

Brace matching

When the cursor reaches an opening or closing brace { }, square bracket [ ] or parentheses ( ), Padre automatically highlight the pair of the braces.

TODO make this optional, let the user set the color

Autosave on/off?

File and Project oriented preferences

Indentation should be by TABs or spaces
In case of using spaces for indentation, the width of every indentation level

Other features

Autobackup (Planned)

See Padre::Autosave

When Padre opens a file it automatically creates a copy of the original in ~/.padre/backup/PATH where PATH is the same PATH as the full PATH of the file. On Windows the initial drive letter is converted to another subdirectory so c:\dir\file.txt will be saved as ~/padre/backup/c/dir/file.txt

When a new file is created no need for autobackup.

When a remote file is opened the backup will probably go to ~/padre/backup_remote/

Configurable options: on/off

Autosave files (Planned)

Every N seconds all the files changed since the last autosave are saved to a temporary place maybe ~/.padre/save.

When the user closes the file, the autosaved file is removed.

Configurable options: on/off, frequency in seconds

SQLite

Padre is using an SQLite database (~/.padre/config.db) for two things. Part of the preferences/configuration information is kept there and it is used for the podreader.

Documentation POD reader

Padre currently can index (the names of) all the modules on your system and it was planned to have a search capability for modules/functions/etc.

Plugins

There is a highly experimental but quite simple plugin system.

A plugin is a module in the Padre::Plugin::* namespace optionally packaged as a PAR archive.

At startup time Padre looks for all such modules in @INC and in its own private directory and loads them.

Every plugin must be a subclass of Padre::Plugin and follow the rules defined in the Padre::Plugin API documentation.

See also Padre::PluginManager and Padre::PluginBuilder

While Padre is running there is a menu option to show the Plugin configuration window that shows the list of all the plugins.

TODO: What to do if a newer version of the same plugin was installed?

TODO: What to do if a module was removed ? Shall we keep its data in the configuration file or remove it?

TODO: Padre should offer an easy but simple way for plugin authors to declare configuration variables and automaticly generate both configuration file and configuration dialog. Padre should also allow for full customization of both for those more advanced in wx foo.

Editing tools

Case Changes

Change the case of the selected text or if there is no selection all the text in the current file.

Change all characters to upper or lower case

Change the first character ot every word to upper/lower case leaving the rest as they were.

Tab and space conversion

Tab to Space and Space to Tab conversions ask the number of spaces each tab should substitute. It currently works everywhere. We probably should add a mode to operate only at the beginning of the lines or better yet only at the indentation levels.

Delete All Ending space does just what it sais.

Delete Leading Space will ask How many leading spaces and act accordingly.

Search, Find and Replace

(planning)

Ctrl-F opens the search window, if something was selected then that is given as the search text. Otherwise the last search string should be displayed.

Provide option to search backwards

Limit action to current block, current subroutine, current file (should be the default) current project, current directory with some file filters.

When the user presses Find

  1. We find the first hit and the search window disappears. F3 jumps to next one.

  2. The first match is highlighted and focused but the window stays When the user clicks on the Find button again, we jump to the next hit In this case the user must be able to edit the document while the search window is on.

  3. All the matches are highlighted and we go to the first match, window disappears. F3 jumps to next one

  4. All the matches are highlighted and we go to the first one, window stays open user can edit text

Find and Replace

Find - find the next occurance

Replace all - do just that

Replace - if currently a match is selected then replace it find the next occurance and select it

TODO describe what to do if we have to deal with files that are not in the editor

if "Replace all" was pressed then do just that 1) without opening editors for the files. 2) opening an editor for each file and keep it in unsaved state (sounds carzy having 1000 editors open...) if Search or Replace is clicked then we might show the next location in the lower pane. If the user then presses Replace we open the file in an editor window and go on. If the user presses Search then we show the next occurance. Opened and edited files will be left in a not saved state.

Code layout

Padre.pm

is the main module.

Padre::Autosave

describes some of our plans for an autosave mechanism. It is not implemented yet. (There is also some description elsewhere in this document).

Padre::Config

reads/writes the configuration files.

There is an SQLite database and a yml file to keep various pices of information. The database holds host related configuration values while the yaml file holds personal configuration options.

The SQLite database holds the list of modules available on the system. It will also contain indexing of the documentation Looking at the entries of modules List of functions

Padre::DB

The SQLite database abstraction for storing Padre's internal data.

Padre::Document

is an abstraction class to deal with a single document.

Padre::Document::PASM
Padre::Document::PIR
Padre::Document::Perl
Padre::PluginBuilder
Padre::PluginManager

locates and loads the plugins.

Plugin

Should be the base class of all plugins.

Padre::Pod2HTML
Padre::PPI
Padre::Project

Abstract class understanding what a project is.

Padre::Project::Perl

Is a Perl specific project. These are work in process. Not yet used.

Padre::TaskManager

Managing background tasks.

Padre::Task

Background tasks.

Padre::Util

Various utility functions.

Wx GUI

The Padre::WX::* namespace is supposed to deal with all the wx related code. Outside of that the code is not supposed to know about wx, but currently it still does.

Padre::Wx
Padre::Wx::Ack

Implementation of the ack integration in Edit/Ack menu item. It probably should be either under Dialog or moved out to be a plug-in.

Padre::Wx::App

is the Wx::App subclass. Does not really do much.

Padre::Wx::Dialog

is the parent class of all the major dialogs that are all implemented in modules in the Padre::Wx::Dialog::* namespace. It is actually a plain subclass of Wx::Perl::Dialog.

Padre::Wx::Dialog::Bookmarks
Padre::Wx::Dialog::Find

Current Find and Replace widget.

Padre::Wx::Dialog::ModuleStart

Module::Start integration. Maybe it should be moved to be a plug-in.

Padre::Wx::Dialog::PluginManager
Padre::Wx::Dialog::Preferences
Padre::Wx::Dialog::Search

This is the newer Firefox like search box. Not yet integrated.

Padre::Wx::Dialog::Snippets
Padre::Wx::FileDropTarget

The code for drag and drop

Padre::Wx::Editor

holds an editor text control instance (one for each buffer/file). This is a subclass of Wx::StyledTextCtrl also known as STC or Scintilla.

Padre::Wx::History::ComboBox
Padre::Wx::History::TextEntryDialog
Padre::Wx::Main

This is the main window, most of the code is currently there.

Padre::Wx::Menu

handles everythin the menu should know and do.

Padre::Wx::Output

the output window at the bottom of the editor displaying the output of running code using F5.

Padre::Wx::HtmlWindow
Padre::Wx::PodFrame
Padre::Wx::Popup

not in use.

Padre::Wx::Printout

Implementing the printing capability of Padre.

Padre::Wx::RightClick

not in use.

Padre::Wx::SyntaxCheck

Implementing the continous syntax check of perl code.

Padre::Wx::ToolBar

handles everything the toolbar should know and do.

BUGS

Please submit your bugs at http://padre.perlide.org/

SUPPORT

I hope the http://www.perlmonks.org/ will be ready to take upon themself supporting this application.

See also http://padre.perlide.org/

COPYRIGHT

Copyright 2008-2009 The Padre development team as listed in Padre.pm. http://padre.perlide.org/

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

ACKNOWLEDGEMENTS

The Padre development team

The developers of Padre in alphabetical order:

Aaron Trevena (TEEJAY)

Ahmad Zawawi أحمد محمد زواوي (AZAWAWI)

Adam Kennedy (ADAMK) <adamk@cpan.org>

Breno G. de Oliveira (GARU)

Brian Cassidy (BRICAS)

Cezary Morga (THEREK) <cm@therek.net>

Chris Dolan (CHRISDOLAN)

Claudio Ramirez (CLAUDIO) <claudio@apt-get.be>

Fayland Lam (FAYLAND) <fayland@gmail.com>

Gábor Szabó - גאבור סבו (SZABGAB) <szabgab@gmail.com>

Heiko Jansen (HJANSEN) <heiko_jansen@web.de>

Jérôme Quelin (JQUELIN) <jquelin@cpan.org>

Kaare Rasmussen (KAARE) <kaare@cpan.org>

Keedi Kim - 김도형 (KEEDI)

Kenichi Ishigaki - 石垣憲一 (ISHIGAKI) <ishigaki@cpan.org>

Max Maischein (CORION)

Patrick Donelan (PATSPAM)

Paweł Murias (PMURIAS)

Petar Shangov (PSHANGOV)

Steffen Müller (TSEE) <smueller@cpan.org>

Translators

Arabic - Ahmad M. Zawawi - أحمد محمد زواوي (AZAWAWI)

Chinese (Simplified) - Fayland Lam (FAYLAND)

Chinese (Traditional) - BlueT - Matthew Lien - 練喆明 (BLUET) <bluet@cpan.org>

Dutch - Dirk De Nijs (ddn123456)

English - Everyone on the team

French - Jérôme Quelin (JQUELIN)

German - Heiko Jansen (HJANSEN)

Hebrew - Omer Zak - עומר זק, Shlomi Fish - שלומי פיש (SHLOMIF) and Amir E. Aharoni - אמיר א. אהרוני

Hungarian - György Pásztor (GYU)

Italian - Simone Blandino (SBLANDIN)

Japanese - Kenichi Ishigaki - 石垣憲一 (ISHIGAKI)

Korean - Keedi Kim - 김도형 (KEEDI)

Russian - Andrew Shitov

Polish - Cezary Morga (THEREK)

Portuguese (Brazilian) - Breno G. de Oliveira (GARU)

Spanish - Paco Alguacil (PacoLinux), Enrique Nell (ENELL)

Czech - Marcela Mašláňová (mmaslano)

Norwegian - Kjetil Skotheim (KJETIL)

Thanks

To Mattia Barbon for providing WxPerl. Part of the code was copied from his Wx::Demo application.

To Herbert Breunung for letting me work on Kephra.

To Octavian Rasnita for early testing and bug reports.