Table of Contents
List of Figures
Table of Contents
Bluefish has a large feature set, allowing the user to customize the editing experience in numerous ways. This manual targets both novice and advanced users, providing a full resource for everyone.
Chapters 1-3 are highly recommended for anyone new to Bluefish. They present general information, installation instructions, and an introduction to the main features of Bluefish.
Chapter 4 explains how to debug Bluefish.
Chapters 5 contains a nearly complete feature reference, useful for advanced users interested in customizing Bluefish.
Chapters 6 provides guidance for developers, including code formatting styles and a reference for all the source files.
The manual targets the end user. To that end, we have tried to use a simple, well-explained approach whenever possible. Some typographic conventions are denoted below.
$ foo -bar | bang -lNote: Do not write the $ character - it simply identifies the command prompt. For commands requiring root access, the prompt is shown as a #.
Finally, if you find errors in this manual or wish to write new sections, join the mailing list and let us know. Guidelines for this manual can be found in Appendix C, Guidelines for Writing this Manual
Bluefish is a powerful editor for experienced web designers and programmers based on the GTK2 GUI interface. Bluefish supports many programming and markup languages, but focuses on editing dynamic and interactive websites.
Bluefish is not a WYSIWYG[1] text editor. This is deliberate, allowing the programmer to stay in full control. To facilitate the editing process, a large number of features are at your disposal. For inserting markup and code, there are tool bars, dialogs, and predefined/user-customized menus. Syntax highlighting, advanced search/replace functionality, scalability and language function references make Bluefish a powerful tool for development.
Bluefish development started under a different name. A good and free text editor targeted towards web development was not available. Olivier Sessink started the project ProSite. Chris Mazuc also started an HTML editor. On a GTK development mailing list, Olivier Sessink and Chris Mazuc saw each others postings, and decided to team up. Olivier had a basic editor, Chris had many HTML dialogs ready. After merging the code this was for a while known as the Thtml editor.
After a while Neil Millar joined the project to add weblint integration and a color dialog. Because the project became larger and more mature, a logo was wanted. After many discussions about boring logos, Neil Millar came up with a cute blue fish. Because this logo was appreciated by all, the name changed into the final name Bluefish.
After this initial stage, many developers, translators, testers and users joined the project.
Several years have passed since the first Bluefish release. Since that time, the fish has gained a reputation as an excellent editor, with qualities like stability, usability and numerous features. Also, Bluefish is small, fast and efficient, making it usable even on slow machines.
This list will give you an overview of the most important or outstanding features found in Bluefish.
As Bluefish is a part of a larger desktop environment, we have focused on making the GUI consistent with the Gnome HIG [2] . However, we prefer not following it in every detail, as some parts are intended for the end user , while Bluefish is for the programmer .
Some features from v0.7 (GTK1) are not yet implemented. The main missing piece is project management, which will be implemented before v1.0. If you depend on this feature, v0.7 may still be the version of choice.
Quite stable! The Bluefish developers aim to produce code that neither crashes nor leaks memory. Of course, that is not always easy to do. Leaks and crashes are often fixed in CVS as soon as they are discovered and hunted down. In addition to Bluefish's large user base, the developers use Bluefish for their daily work. So, fixing bugs and preventing crashes is always a major priority. However, some nags still exist. One example being the issue of slightly sluggish copy/paste functions.
For an updated list of open bugs, please visit the s-list on the Bluefish WiKi, at http://bfwiki.tellefsen.net/?pagename=ToDoList .
We appreciate any and all contributions! Please tell us if Bluefish crashes on you :-).
We, the Bluefish development team, welcome all comments, user requests, constructive criticisms, and contributions. Are you curious or seeking information regarding Bluefish? Would you like to contribute by translating Bluefish or its manual? Here are your options:
[1] What You See Is What You Get
[2] GNOME Human Interface Guidelines, accessible at http://developer.gnome.org/projects/gup/hig/
Table of Contents
Currently, four versions of bluefish are available:
As commented in Section 1.1, “How and When Updates are Released”, the long time between stable releases makes the CVS snapshots and current CVS an enticing choice.
If you want the latest and greatest, read Section 3, “Latest Developmental Version” below. If you simply want to use Bluefish, read Section 2, “Latest Stable Version” for how to get the latest stable package for your system.
Due to the small number of volunteer developers, the progression of Bluefish's development often fluctuates. For this reason, a long time may pass between each release. After all, the developers volunteer their time and effort because they actually want to use Bluefish :-)
Because of the long periods of time between releases, the current CVS or CVS snapshots may be what you want to use. Bugs will be fixed and new features introduced. We do try to keep the CVS version usable at any time (actually, the CVS version is used by most of the development team on a daily basis).
Bluefish has been reported to work on a number of systems. The Bluefish team mainly support these platforms:
Actually, any GNU/Linux distribution with GTK2 is fine and many distributions include Bluefish. In fact, Bluefish will likely work quite well on any POSIX compatible OS where GTK2 is available. Bluefish has been reported to work on the following:
Many Linux distributions ship a version of Bluefish or make it available through their package systems. For example, Bluefish is available through the Debian apt-system and FreeBSD's ports. You may check if Bluefish is available through your favorite software installer.
However, the main source is the Bluefish website, where the software and a few contributions are available. The download page is reachable at http://bluefish.openoffice.nl/download.html. Here, you may download the source code and binary packages for Debian, Red Hat/Fedora, and Mandrake.
To get the latest version of Bluefish you will need to download the source files from our CVS repository.
CVS [3] , a version control system, is a widely used software development tool. It keeps track of changes to the source code, and allows for reversion to previous states. If you want to read more about CVS, have a look at the CVS-book by Karl Fogel, available at http://cvsbook.red-bean.com/cvsbook.html.
The Bluefish project's CVS repository is generously hosted by SourceForge.net [4]. For more information about them, see their site. The project homepage is http://sourceforge.net/projects/bluefish. Our CVS repository contains the current Bluefish source code, including this manual. The repository is accessible by anyone, and is updated almost daily by the developers.
To access the repository, you need a few small utilities. They are likely to be available through your favorite source of software (ports, apt, etc). The above-mentioned CVS-book is a great source for information.
The first step is to cd to the directory in which you want to put the sources. Next, log in using the command:
$ cvs -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/bluefish login
(just hit Enter at the password prompt) The next step is to check out the CVS module containing the source code files:
$ cvs -z3 -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/bluefish co bluefish-gtk2
A lot of files will be downloaded, and listed one by one. If you're on dial-up, this might take a bit of time. Be patient ;-)
When the downloads have completed, you will find the bluefish sources in the subdirectory bluefish-gtk2. You can now enter that directory and install bluefish using the instructions in Section 4.2, “Installing from Development Source Tree”
Table of Contents
Bluefish aims to be portable, that is, wherever GTK is ported. A comparatively small set of external libraries are necessary for it to work. Any recent GNU/Linux distribution or other *NIX with GTK2 installed should be sufficient. In addition to the list of requirements below, you may also want to look at Section 3, “System Specific Installation Issues”. Note: These requirements fit the GTK2-version. If you only have GTK1, you want the last GTK1-version, v0.7.
The main requirements:
Optional requirements:
Compiling Bluefish requires a few additional packages. (Remember that binary packages exists for many platforms. It is likely you won't need to compile ;-) ). Now, let's assume you want to compile, perhaps to get the latest and greatest from CVS. The requirements are as follows:
There are two main methods for installing Bluefish: Compile from source or install a binary package. Binary installation is the easiest to do, so we'll cover that first. There are a few different approaches, caused by the differences between systems. We'll start off by summarizing a few really quick and simple approaches before dealing with this problem more extensively.
Different systems have different approaches to solutions and packaging. You might find the information below interesting.
Mandrake:
$ rpm -ql pcre-devel
Debian:
By installing Bluefish from source, you may be able to get a newer version (from CVS) than those distributed as binaries. You may also need to compile from source if there is no available binary for your system.
This is the short installation description. Consult the other chapters if you are in doubt.
Bluefish is installed using the standard 'configure, make, make install' steps. Assuming you have downloaded a bluefish source package, for instance bluefish-ver.tar.gz (naturally, change the filename to what's appropriate), you complete the installation with the following steps:
The configure script is used to automatically find the appropriate settings for your system. Because of differences between systems, this compile-time configuration is necessary, and configure solves this challenge easily -- with an added bonus of telling whether you have everything you need to compile.
The configure-script can be, um, configured. This is something you most likely won't need to do, but it's easy to do if necessary. For a complete list of configure options, see Section 5, “Configure Options”
You can get the latest Bluefish version via CVS using the instructions in Section 3, “Latest Developmental Version” Enter the directory containing the bluefish source files:
$ cd bluefish-gtk
Next, you need to generate the configure script. That's accomplished by running
$ autoconf
Then, you run configure with whatever options you might want. This example will cause make install to install Bluefish with the specified directory as prefix (i.e. the binary is installed in /usr/local/bf-cvs/bin/bluefish). This is most likely not what you want -- just run configure without parameters instead.
$ ./configure --prefix=/usr/local/bf-cvs
If configure fails, it'll probably give a hint telling you what's missing or wrong. Assuming it completed successfully, your next step is to compile Bluefish. To do this, run
$ make
When make has completed, you can install Bluefish: (su to root first, unless you specified a user writable prefix to configure)
# make install
To update the sources at a later time, you run the command cvs -z3 -q update from within the bluefish-gtk2 directory.
Can't compile? Well, your first step is to make sure you have the necessary utilities and libraries. See Section 1, “Requirements”. Next, see if your system is mentioned in Section 3, “System Specific Installation Issues”. Below is list of well known problems that have been mentioned on the bluefish-dev list. If you're unable to find a solution (or if you think you have a solution others might want), feel free to contact us on the bluefish-dev list (See Section 2.4, “Contact Us”).
make: *** No targets specified and no makefile found.
Stop.
This will happen if
configure
fails and you try to run
make
. It also happens if you're running
make
from the wrong directory.
This section describes all the configure options available for bluefish.
Configuration:
display this help and exit
display options specific to this package
display the short help of all the included packages
display version information and exit
do not print "checking..." messages
cache test results in FILE [disabled by default]
alias for --cache-file=config.cache
do not create output files
find the sources in DIR [configure dir or .. by default]
Installation directories:
install architecture-independent files in PREFIX [/usr/local by default]
install architecture-dependent files in EPREFIX [PREFIX by default]
By default, make install will install all the files in /usr/local/bin, /usr/local/lib, etc. You can specify an installation prefix other than /usr/local using --prefix, for instance --prefix=$HOME.
Fine tuning of the installation directories:
For better control, use the options below. Defaults are shown within brackets.
user executables [EPREFIX/bin]
system admin executables [EPREFIX/sbin]
program executables [EPREFIX/libexec]
read-only architecture-independent data [PREFIX/share]
read-only single-machine data [PREFIX/etc]
modifiable architecture-independent data [PREFIX/com]
modifiable single-machine data [PREFIX/var]
object code libraries [EPREFIX/lib]
C header files [PREFIX/include]
C header files for non-gcc [/usr/include]
info documentation [PREFIX/info]
man documentation [PREFIX/man]
Program names:
prepend PREFIX to installed program names
append SUFFIX to installed program names
run sed PROGRAM on installed program names
System types:
configure for building on BUILD [guessed]
cross-compile to build programs to run on HOST [BUILD]
Some influential environment variables:
Use these variables to override the choices made by configure or to help it to find libraries and programs with nonstandard names/locations.
C compiler command
C compiler flags
linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>
C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>
C preprocessor
Optional Features:
It works as is: --enable-feature enables the feature, --disable-feature or --enable-feature=no disables the feature.
By default, the --enable-feature option is not enabled, you should pass it if you want to get it, the --disable-xxx option is not disabled, you should pass it if you want to disable it.
optimizes the build process for a given architecture if possible
How: rely on the result of:
uname -p or grep "model name" /proc/cpuinfo | cut -d: -f2 to detect the architecture
the version of gcc to pass the arguments
Tested gcc versions: 3.2.*, 3.0.*, 2.95.*
Machines: Intel(R) Pentium(R) 4CPU, Pentium III, AMD-K6 (tm) 3D, Pentium 75 - 200, Pentium II, AMD Athlon(TM) XP
Other machines are ignored
optimizes the build process for a given architecture if possible
Machines: i386, i486, pentium, pentium-mmx, pentiumpro, pentium2, pentium3, pentium4, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-4, athlon-xp, athlon-mp, winchip-c6, winchip2, c3
Other machines are ignored
optimizes the build process for a given architecture if possible
Machines: i386, i486, pentium, pentiumpro, k6
Other machines are ignored
turns debugging output on (this option impacts performance)
suppresses the display of the splash screen at launch time (Bluefish launches faster)
outputs statistics on where the program spends most of its time when highlighting patterns.
Usage: for debugging highlight patterns or trying to optimize the program
enables development checks (slows down the program)
outputs statistics on where the program spends most of its time by generating extra code to write profile information suitable for the analysis. (slows down the program)
Purpose: to be able to collect statistics on how many times each branch is executed and how long it has lasted. Creates data files for the gcov code-coverage utility. (slows down the program)
disables the Native Language Support
Optional Packages:
This works as is: --with-xxx=foo enables the flag, --without-xxx disables it. When not enabled, the default is used.
customized path for the icon.
Usage: --with-icon-path=customizedpath
Defaults to: /usr/share/pixmaps
customized path for the gnome1 menu.
Usage: --with-gnome1-menu=customizedpath
Defaults to: /usr/share/gnome/apps/
customized path for the gnome2 menu and mime-type
Usage: --with-gnome2-prefix=customizedpath
Defaults to: /usr/share/
customized path for libiconv top level installation.
Usage: --with-libiconv-prefix=customizeddir
Effect: searches for libiconv in customizeddir/include and customizeddir/lib
use the GNU gettext library included in the package
Different packages -- different installation. We'll cover only a few approaches here [5] , since the installation is very system-specific ;-). Lets have a look at some different systems:
For Debian users this is very simple. To download, install and configure bluefish in One Swift Move, run
$ su - && apt-get update && apt-get install bluefish
You can check if the version available through apt is the latest -- see the Bluefish homepage, and compare the version there with what apt-cache show bluefish tells you. If there's a newer version on the Bluefish site, download it and install the package like this: dpkg -i bluefish-ver.deb
For rpm based distributions, first check if your distribution has a recent Bluefish version. If it does not, download the rpm for your distribution from any of the Bluefish mirrors. Next, installing a downloaded rpm is as simple as pointing and clicking in your favourite GUI package manager, or issuing the following command from the command line: (as root)
# rpm -Uvh bluefish-ver.rpm
If you're using FreeBSD, NetBSD or OpenBSD, we probably won't need to tell you how to use your favourite package system. ;-)
The first time you run Bluefish it will create a directory ~/.bluefish where all configuration is stored. This includes all preferences, customized menus, highlighting-patterns, file history etc.
Bluefish will work right out of the box, but you can and should take advantage of the many customizations you are able to do. Change the font in the main text view if you don't like it, remove unused toolbars, add shortcuts to the customizable menu and edit the list of browsers and external programs.
If you are upgrading from a previous version, perhaps CVS, you should note that the syntax highlighting may have changed. To make sure you have the latest highlighting patterns, exit Bluefish and delete the highlighting file in your ~/.bluefish directory. Next time Bluefish is started, the new defaults will be loaded. Note that this will also annihilate all your changes to the highlighting. A more gentle approach may be to move your current highlighting-file to highlighting.old, start Bluefish to get the new patterns, exit bluefish, and then run diff -c highlighting.old highlighting to find the differences..
If your settings should happen to be corrupted, for some reason unusable, or you simply want to revert to the defaults, you may safely delete the ~/.bluefish directory.
[5] If you want to contribute a description on how to install Bluefish on your system, just drop us a note. :-)
Table of Contents
In this chapter most of the functionalities of Bluefish are described. What you can do, how you do it, and how you can customise the default behaviour.
In GNOME Bluefish is started from the Applications/Programming menu.
There are several useful command line options.
-s skip root check
-v current version
-n open new window
-p filename open project
-h this help screen
--display
Many programs like browsers, email clients and file managers can be configured to open files in Bluefish. For example bluefish '%s' will open a file in the current window, bluefish -n '%s' will open a file in a new window, and bluefish -p '%s' will open a project file.
The biggest part of the user interface is the editor area. Because Bluefish has a so called "Multiple Document Interface", there are actually many editor areas in Bluefish, accessible via the tabs. By default the tabs are on the bottom.
The top of the Bluefish interface consists of a menu, a main tool bar, a HTML tool bar, and a Custom menu.
The main toolbar gives you quick access to the basic functionalities of a text editor.
The HTML toolbar deals with most used HTML functionalities.
The custom toolbar provides access to languages and replacement functions. It is fully customizable through the preferences panel.
On the side, by default the left side, there is the side panel. The side panel consists of a file browser, a function reference browser and a bookmark browser.
This is where you may get quick access to files, switching directories in the upper part.
The function reference browser references CSS2, HTML, PHP, and Python functions with their syntax.
The bookmark browser allows you to access directly a marked position in a file.
On the bottom of Bluefish is the status bar. Here messages are shown, the current line and column number are shown, the insert (INS) or overwrite (OVR) mode for the cursor, and the file type and character encoding.
The visibility of these items can be toggled via the menu.
If you want to disable any of these items by default, you can set these options in the preferences under User interface.
Most of the file operations are accessible from the . Through it, a new file can be created, existing files opened, and opened files saved or renamed.
It is also possible to insert a file into another one, and to revert a modified file to its previously saved state.
Apart from using -> (Ctrl-N) or the New icon to create a new file, you may also use -> (Shift-Ctrl-N).
Both methods create an untitled file of type text with the default character encoding defined in preferences.
Through -> (Ctrl-O) one or more files can be opened. As for creating files, you may want to open the files in a new window. In this case, use -> to first open the new window and then open the desired files as usual.
The latest opened directories appear in the upper part of the left side panel, while you have the possibility to add the most often accessed directories to the lower part. You may also filter the files to be opened with the pop menu located on the right side, whose contents mirror the file types defined in preferences.
Recently opened files can be opened by selecting them from the list within ->. The number of files in this menu can be set in the preferences under Files.
The file browser in the side panel can also be used to open files. It supports filtering files, by right clicking the contextual menu in the filebrowser.
The available filters may be modified in Preferences. For more information, see Section 5.4, “Modifying the files filters”.
If you right click a directory, you can make this directory the base directory for the filebrowser using the option. Then you can access it directly from the popup menu in the upper part of the file browser.
By default the filebrowser follows the document focus. If you change to a different document, the filebrowser will show the contents of the directory where this document is located. This behaviour can be changed on the bottom of the filebrowser.
Information about currently opened files can be seen if you move the mouse over the document tab (by default on the bottom of the screen). A so called tooltip will be shown with information about the full path, size, permissions, filetype and encoding of the file.
An interesting feature of Bluefish is the ability to open files by selecting the text of a currently opened file. For example, if a filename is shown in say a terminal application, you can select the filename, and use -> to open that file. The file, if it exists, will be opened in another tab within Bluefish.
Finally, files can be opened via the command line by feeding filenames to Bluefish as arguments. This can even be done while Bluefish is running and the resulting file will then show up in its own tab.
Files can also be opened by clicking on the Open... icon in the main toolbar.
If you have installed gnome-vfs or gnome-vfs2 before installing Bluefish, you will be able to open files on remote desktop.
If a document is modified, the filename is shown in red in the document tabs, and also if you right click on the tabs, the full path is shown in red in the list that will pop up.
To save a document, you can use the menu, the Save icon in the toolbar, or press the shortcut key combination Ctrl-S. By default a backup is made during save. The original file is copied to the same filename with a tilde ~ appended. This suffix and the backup behaviour can be changed in the preferences under Files.
Before saving the file, Bluefish will check if the original file was changed on disk, using the last modified time and the file size. On some filesystems the last modified time is sometimes not very precise (most notably on samba mounts). This makes Bluefish think the file is modified when it is not. This check can be changed in the preferences under Files.
You can also save a document under a different name, using the (Shift-Ctrl-S) menu entry, or the Save As... icon in the main toolbar. The original file will still exist.
To save all modified files, you can use the -> menu entry. This will save all documents that have been modified and bring you a save dialog if some files are new files.
It is also possible to move or rename a document, using the -> (F2) menu item, or right-clicking the file name in the side panel and choosing the item.
When you want to close a file quickly, click on the close icon in the document tab. You may also use the Close icon in the main toolbar, or the -> (Ctrl-W) menu item.
If the file is unchanged, it is merely closed. If the file has been modified, you will be presented with a save dialog.
Use it to save and close a file in one step.
When dealing with multiple files, you may want to use the -> (Shift-Ctrl-W) menu item.
For each modified file, you will be presented with a save dialog, where you can choose to save the changes, close the file (i.e. discarding any change), or cancel the operation.
Say you have a number of open files, and only a few of them have been changed. To quickly close the unchanged files, and remain with the modified ones, use it answering cancel for the latter ones.
Note that the -> menu item offers the same behaviour.
You can insert any file into the current document with the -> menu item. The file will be inserting at the cursor location.
For more in-depth information about dealing with files, see Section 2.9, “More on files”.
The undo and redo functionalities are available from the menu, the main tool bar, and the keyboard shortcuts.
(Ctrl-Z)
(Shift-Ctrl-Z)
The functions and in the menu will undo or redo all of the stored changes. The maximum number of changes can be configured in the preferences, by default Bluefish will remember the last 100 changes per document. It is possible to clear the changes after the document is saved, an option in the preferences which is disabled by default.
The functions , , and are available from the menu, the main tool bar, and the keyboard shortcuts.
(Ctrl-X)
(Ctrl-C)
(Ctrl-V)
On X Windows Systems, you can also paste the current selected text using the middle mouse button. First select some text (in Bluefish or in any other X application), then press the middle mouse button where you want to paste the selected text.
Cut or copy and then paste can also be done by selecting some text and dragging it to the destination. If the text is dragged to another document (or another application), it is copied. If the text is dragged within one document it is moved. Dragging to other applications is not possible to every application, but most Gnome and GTK programs are supported.
Bluefish is able to deal with a number of input methods, available from the contextual menu within a given document.
The default mode switches all input methods off.
The Amharic mode is used for the most popular Ethiopian language.
The Cedilla mode is used for languages such as French, which uses the cedilla.
The Cyrillic mode is used to enter Russian with Roman letters. The transliteration occurs immediately.
The Inukitut mode works the same as Cyrillic mode.
The IPA mode is used for International phonetic alphabet.
Other modes are used for Erythrean, Ethiopian, Thai and Vietnamense languages.
The X Input method relies on a client-server input system, and an input server.
For Japanese, Chinese, and Corean documents, you may have to install and launch the right input system, such as canna, and the right input server, such as kinput2.
Here is how to write a Japanese document on a non-Japanese system.
Procedure 3.1. Writing in Japanese with Bluefish on a non-Japanese system
Launch the canna server if it is not running already
Set the encoding to Japanese, for example: export LANG=ja_JP.UTF-8
Set the Xinput method with export XMODIFIERS="@im=kinput2"
Launch kinput2 as a background process with kinput2 &
Launch bluefish as a background process with bluefish &
To activate the Xinput method within bluefish, use Shift-Space. A small window with a Japanese glyph will appear at one of the corner of the Bluefish window. Once the desired glyph has been composed, press Space, and hit enter to validate it.
Here, you can see the small Xinput method window, at the bottom left corner of the window and the first Japanese word not already validated in the Bluefish window launched on a French system.
For an in-depth discussion on that subject, see Inputting from the keyboard.
The file type of a file changes the behaviour of Bluefish. File types are recognised by their extension, or by the beginning of the content of the file. The current document type is shown in the far right of the status bar. How these extensions and patterns can be changed is described in Section 5, “Customising Bluefish”.
If the type of a file is not properly detected, you can change the type using the -> menu.
Syntax highlighting is the coloring of words that have a special meaning in the language you are writing. Obviously the patterns are different for every language. The "<title>" word for example means "start of title" in HTML, the "function" word means "start of function" in PHP.
During the editing, Bluefish will only update the highlighting patterns in the block of text around the cursor. The number of lines (the size) of this block can be adjusted in the preferences under Editor.
The syntax highlighting for the total document can be refreshed using the -> (F5) menu. The syntax highlighting can be disabled in the preferences under Editor.
Assuming a working Internet connection, files can also be opened from the web using -> (make sure to type the http:// or it doesn't work... bug, maybe???).
Be aware that if the file is huge or optimized (i.e. the lines are very long), it may take a very long time to get the rendering if syntax highlighting is enabled.
Here you can see the style sheet of an Apache web site, nicely highlighted after its opening via the Bluefish -> menu.
There are many different standards for character encoding of text files. Most well known is the ASCII standard, which describes only 127 characters, and is supported by every text editor in the world. The most common standard nowadays is UTF-8, which describes thousands of characters, and is backwards compatible with ASCII. Internally, Bluefish will always work with UTF-8. When opening a file, Bluefish has to detect the correct encoding for the file. For HTML files the encoding should be present in a <meta name="encoding"> tag. Bluefish will always use this tag if it is available in the file. If this tag has an encoding that is not present in the Bluefish config file, this encoding is automatically added to the Bluefish config file.
The locale also defines a default encoding. If you are using a locale (a local setting, defining language, time format, currency format, number formatting etc.), Bluefish will try to load the file using the encoding defined in the locale.
Bluefish itself also has a setting for a default encoding. This is the next encoding Bluefish will try. This is also the encoding Bluefish will use for files created by Bluefish (UTF-8 by default).
If these steps fail, Bluefish will simply try every encoding defined in the Bluefish config file.
Filenames on disk can also contain non ASCII characters. All Gnome and GTK programs (including Bluefish) assume that filenames are in UTF-8 encoding. If you have filenames in the encoding of your locale on your disk, you have to set G_BROKEN_FILENAMES=1 in the environment to make Gnome and GTK programs detect this encoding.
For information about writing documents in 16-bits encoded languages, such as Japanese, see Section 2.7.3, “Input methods”.
In the Open Advanced dialog, accessible from the -> (Shift-Ctrl-O) menu item, multiple files can be opened from a directory based on their extension or their contents. The same functionality is available from the filebrowser in the side panel. If you right click a directory, you can also there select .
To open all files by extension, enter the extension in the dialog, and leave the search pattern empty. Check the recursive option if you want to include all subdirectories in the search.
To open files by content, leave the extension at *, and enter a search pattern in the dialog. You can use regular expression patterns if you check the Is regex option.
The open advanced functionality runs the find and grep utilities to get a list of filenames. If these utilities are not available on your system the functionality is not available.
You may also combine both methods. Here we open recursively all Chinese xml files in a given tree, whose contents contain the word packaging.
The editing area is a standard GTK editing area. This means there are many keyboard shortcuts available to navigate through the text.
Ctrl-Right-Arrow will jump to the next word boundary
Ctrl-Left-Arrow will jump to the previous word boundary
End will jump to the end of line
Home will jump to the beginning of the line
Page-Up will jump one page up
Page-Down will jump one page down
Ctrl-Home will jump to the top of the document
Ctrl-End will jump to the end of the document
These shortcuts are also available when selecting text. Some examples:
To select the current line, press Home, hold Shift and press End.
To select the current word, press Ctrl-Left-Arrow, hold Shift and press Ctrl-Right-Arrow.
Navigating through a large list of documents can be difficult. But if you right-click the document notebook tabs, you get a list of all opened documents.
Navigation between documents can also be done using the menu, or its shortcuts.
The shortcuts are the following:
Ctrl-Page-Up will change to the previous document
Ctrl-Page-Down will change to the next document
Shift-Ctrl-Page-Up will change to the first document
Shift-Ctrl-Page-Down will change to the last document
The -> (CtrlL) offers an interesting feature.
If there is some number in the document, you may select it, then click the From selection label in the Goto line dialog. Bluefish will fill in the Line number field with that number and go directly to it.
The same feature is available from the ->.
You may want to check the Keep dialog box to keep the dialog open, when you plan to access several parts of the document by line numbers.
The projects are a sort of 'saved state' of Bluefish. All files open when the project is saved, are automatically opened the next time you open the project. Also the recently used files in that project are shown in the recent menu. Furthermore, a basedir can be set, so the file browser in the left panel will only show the files in the basedir and its subdirectories. If Bluefish is installed with gnome-vfs support the basedir might be remote, for example sftp://someserver/somedir or smb://user:password@server/someshare/.
If the webdir is entered in the project settings, Bluefish will launch the browser to the appropriate URL. If your basedir for example is /var/www/ and your webdir http://localhost/ Bluefish will use this information to launch the browser to the correct URL. This can be very convenient for testing server side scripting languages like PHP, JSP or other.
The template field can point to a template file. If the 'new file' button is clicked, the contents of this file will be automatically loaded into the edit window.
The projects will be expanded to have more Bluefish settings, so a project can be a bit of customized Bluefish setup. Currently the state of various tool bars and menu bars is saved in a project file.
The project file itself is simply a text file in the standard Bluefish format (same format as the config file). This format is 'key: value'.
In Bluefish you can add bookmarks to a line in the text, and you can later use the bookmark to quickly jump to this location. Bookmarks can be temporary or permanent, the default can be configured in the preferences.
Bookmarks can be added to the current cursor location by using the menu /Edit/Add bookmark, or by using the shortcut key combination control+d. You can also add bookmarks by right-clicking in the text, and selecting add bookmark.
Bookmarks can be temporary or permanent. Permanent bookmarks are stored, and temporary bookmarks are gone after Bluefish is closed. The default is set in the preferences under Editor. If you right click a bookmark and select Edit you can change this setting for a bookmark.
SCREENSHOT BY ????
A way to add many bookmarks at the same time is using the Find dialog. Check the 'Bookmark results' option, and all search results will be added to your bookmarks. For example this manual has sections, and each section is identified by a header like '<sect1 id="bluefish-ch-4-sect-6">'. A way to automatically get a bookmark to every section is to search for the following regular expression pattern: '<sect[0-9]+ id="[^"]+">' and bookmark all results.
Bookmarks can be found in the side panel, sorted by document and line number. If you right click a bookmark, you get a pop up menu with several options. Among the option is edit, which allows you to change a bookmark from temporary to permanent or the other way around, and you can name bookmarks.
The edit menu features several options for Find and Replace. The Find... (Ctrl+F) and Replace... (Ctrl+H) menu items will simply start the dialogs described elsewhere in this manual. The Find again (Ctrl+G) item will repeat the last used search. It will continue the search after the position where the previous search was stopped. If the end of file is reached, it will restart at the beginning or continue with the next file, depending on the search options used.
SCREENSHOT BY ????
The Find from selection item will search for the currently selected text. If you select for example the name of a function, in bluefish, or in any other program, and you choose find from selection Bluefish will start a new search for this selected string.
With the find and replace you can do incredible things. We'll start with a simple example. In some HTML table we have several table data tags where we actually want table header tags. Table data is <td></td> and we want <th></th>.
SCREENSHOT BY ????
we can do two normal replaces: one where we replace <td> with <th> and then another where we replace </td> with </th>
we can also do one replace using regular expressions: find (<|</)?td> and replace with \0th> For more information about regular expressions you might want to read man 7 regex, or read any of the great Internet sites about regular expressions. The \0 in the replace string refers to the first subpattern match in the search pattern, the \1 to the second etc.
if you understand the above example, you will realize that you can do much more. Suppose you also want to match a table data tag that does have some attributes like <td class="myclass">, and you want to keep the option while converting to table header. The following pattern will do this: find (<|</)td([^>]*)> and replace with \0th\1>
if you have any search and replace patterns you use often, you can also add them to the Custom Menu. Check the Custom Menu section of this manual for more information.
In the find and the replace dialog it is not possible to insert keys Enter or Tab. You can, however, insert escape characters, if you enable the 'Patterns contain backslash sequences' option. If you use this option, you can add a newline to your pattern as \n, a tab as a \t, and a backslash becomes a \\.
Another useful option in the find dialog is the bookmark results option. For example in a PHP document, you could search for the word 'function', and add a bookmark to every function. This results, however, in a list of bookmarks that are all named 'function'. Not so useful. But also now we can make use of a regular expression. The expression 'function[ \t\n]+[&a-zA-Z0-9_]+' will result in all functions and their name. Much more useful!
SCREENSHOT BY ????
The shift-right and shift-left items in the menu, or the buttons in the tool bar, will indent or unindent the currently selected text. It will normally use tabs for indenting, or spaces if you have 'indent with spaces' selected in the preferences. The number of spaces used is the same as the 'tabsize' option in the preferences.
SCREENSHOT BY ????
By default, Bluefish will automatically produce closing tags for HTML and XML documents. For example, if you type <p> within an HTML document, bluefish will produce </p>. So, as soon as you finish typing a non-empty HTML tag, meaning the tag is supposed to have a closing tag, Bluefish will help you out and close the tag automatically. For empty tags, like <br>, Bluefish correctly does nothing. This feature can be turned off by unchecking the menu option Document > Auto Close HTML Tags.
Bluefish has two modes for tag closing, an XML mode and an HTML mode. In XML mode, Bluefish will add a closing tag to any tag that is not closed itself with />. In HTML mode, Bluefish excludes all known tags that do not need a closing tag, such as <br> and <img>.
Bluefish will choose the mode based on the filetype of the document. In the filetype preferences the default mode for each filetype can be set.
Bluefish uses aspell for spell checking. If the aspell libraries are not installed on your system, then the spell checking feature will not be available. To launch the spell checker, select Document > Check Spelling...
The spell checker will launch in a separate window, which you can keep open as you edit files. You have the option to check a whole document or just a selection. Click on Spell Check to start spell checking the current document. As you run across misspelled words you want included in the dictionary, click on the Add button in the spell checker window. This will add words to a personal dictionary.
Key words for different languages can be ignored using filters. Currently, the only filter is for HTML. If you want to help write more filters, join the mailing list.
The function reference browser is a place where reference information about a certain language can be found. Currently Bluefish comes with a PHP reference, a CSS 2.0 reference, an HTML reference and a Python reference. The functions are grouped depending on the language, by type, module, object, etc.
The function reference browser can show a info window on the bottom. Check the 'Show info window' checkbox. In this window some information about the currently selected item can be shown. What exactly is shown can be chosen in the right-click context menu.
SCREENSHOT BY ????
Every item in the function reference can simply insert text, show an info window, or show a dialog that can be used to insert text. In the right-click context menu each of these functions are accessible. One of these functions can be bound to a left-double-click action. This is also configurable from the context menu.
HTML is obviously the most supported language in Bluefish. There is a special HTML tool bar with many dialogs, and several menu sections to work with tags. You can also right-click a tag and bring up the dialog from there. The preferences have several settings on HTML style under HTML.
In the reference tree on the left panel there is also HTML reference available.
There are several special search and replace actions in the menu Edit-Replace special. These can be used to convert special characters (like < and &), or ISO characters to their HTML entities.
Bluefish can automatically generate thumbnails for images. ..... TO BE WRITTEN BY ???
SCREENSHOT BY ????
The quick bar is a user defined tool bar. All HTML tool bar buttons can be added to the quick bar by simply right-clicking them and selecting "Add to quick bar". If you want to remove items from the Quick bar, right-click them and select "Remove from Quick bar"
SCREENSHOT BY ????
The custom menu allows you to add "often used" strings or search and replace patterns to a menu. Upon install Bluefish will create some default entries, these will give you an idea what can be done with the custom menu.
The location for entries in the custom menu is defined by their menu path. A menu path looks like /Main menu/submenu/item or /Main menu/item.
There are two types of items in the custom menu. First is the Custom dialog, which will insert a string, optionally based on values asked in a dialog. Second is the Custom Find and Replace, which will run a replace, also optionally based on values asked in a dialog.
The most simple custom dialog item has a menupath, for example /MySite/author, and a Formatstring before, for example 'written by Olivier'. If you add this item, you can add this string by selecting the menu item.
SCREENSHOT BY ????
In another example, you have a string you often need to set before and after some block of text. For example <div class="MyClass"></div>. Now you choose menupath /MySite/div with class and you choose <div class="MyClass"> as formatstring before, and you choose </div> as formatstring after. Click add, and the item is in the menu. If you now select some text, and activate this menu item, you will see that the first bit of text is added before the selection, and the second bit is added after the selection.
Suppose you want to improve this last example. You have both MyClass1 and MyClass2. Now use 'Number of variables' 1 in the custom menu editor. As you see a new entry appears where you can enter the name for variable %0. As name we enter 'MyClass number', and now we change the formatstring before to <div class="MyClass%0">. If you now activate this menu, it will ask you for a value for 'MyClass number', and then insert the strings, using the value you provided.
SCREENSHOT BY ????
Find and replace items are no different. The dialog has some more options, each of these options correspond to the regular replace dialog. Again you can use variables like %0, %1 etc. to make a certain menu item more flexible.
SCREENSHOT BY ????
You can integrate external commands such as browsers, or text filters. If you want to use for example a sed command as a filter, you can add it like this to the external commands and filters (in the preferences dialog): sed -e 'some sed command' > '%f' < '%s'
To add items to the external menu:
Edit > Preferences
Choose the "External Programs" tab.
Click "Add" to add a new item
Double-click on the name field to give the command a name (this name will become an option in the "External" menu).
Double-click on the command field to type the command to be executed.
I WILL ADD AN EXAMPLE HERE LATER
Items within External > Outputbox allow for programs to give feedback by opening an output box within Bluefish's main window. To create an Outputbox menu item:
Edit > Preferences
Choose the "Output parsers" tab.
Click "Add" to add a new item
Double-click on the name field to give the command a name (this name will become an option in the "External" menu).
Double-click on the pattern field and give a regular expression pattern with subpatterns, such as line ([0-9]+) column [0-9]+ - (.*).
Double-click on the "File #" field and give the number for the subpattern matching the filename (-1 for none)
Double-click on the "Line #" field and give the number for the subpattern matching the line number
Double-click on the "Output #" field and give the number for the subpattern matching the actual error message
Double-click on the "Command" field and the command to execute, %s is the current filename
Toggle the "Show all output" check box to show output NOT matching the regular expression.
Many menu entries are accessible via key combination; also called a shortcut. For example, pressing the Ctrl+S keys saves the current file to disk. If available, shortcut key combinations are shown on the right of the menu entry.
What many people do not know is that they can be changed. Move the mouse over a menu entry, and press the key combination you would like to use. Immediately this combination will show up on the right of the menu entry. An entry can also be removed, press the backspace key when you move the mouse over a menu entry to remove the shortcut.
To save the shortcut key combinations for later Bluefish sessions you can store them. In the Edit menu choose Save shortcut keys. This will store the settings in file ~/.bluefish/menudump_2. If you want to restore the default combinations simply remove this file and restart Bluefish.
The font of the editor can be set in the preferences under Editor.
A frequently asked question is how to change the background color of the editor in Bluefish. Bluefish uses the default editor background color as set in your GTK theme. If you want to override the color of the theme, edit ~/.gtkrc-2.0 and add this section:
style "EditorStyle" {
base[NORMAL]="#eeeeee"
}
class "GtkTextView" style "EditorStyle"
Obviously, #eeeeee should be your preferred background color.
Here you can define all file types that should be recognised by Bluefish. The defaults for these file types are retrieved from a file called file types.default in ${prefix}/share/bluefish/.
The file types consist first of a name (this name is also used in the file filters, and in the highlighting patterns). Second is a list of extensions, separated by a colon (:). Third are the highlighting update characters. Upon a key press of one of these characters, the highlighting engine will refresh the highlighting around the cursor. If this field is empty, any character will force the highlighting engine to refresh. Special characters like the tab and the newline can be entered as \t and \n, the backslash itself is entered as \\. Fifth is the icon location for this file type. Sixth is whether this file type is editable by Bluefish (whether or not Bluefish should try to open it after a double click). Seventh is a regular expression that can be used to detect the file type if a file without extension is loaded. Eight is the auto-tag-closing mode. A value of 0 means that Bluefish should not close XML/HTML tags, a value of 1 means it should close the tags XML style (<br />), a value of 2 means HTML style.
The highlight patterns are build from Perl compatible regular expressions. A pattern has options for coloring and style of the text it matches. Within a match other patterns can be used to color parts of that match. There are three types of patterns:
One specific pattern can also be used within several other parent patterns. The parent-match option is a regular expression that defines all parents for a certain pattern. If empty it will default to ^top$, so basically it will be on the top level.
So how does it work? Lets take a look at a little example text, a piece of PHP code within some HTML code:
<p align="center"> <?php // this is a comment ?> ?>
The first thing the highlighting engine does is finding the pattern that has the lowest match. Using the default patterns for PHP, the pattern named html has a match at position 0:
<p align="center">
So now the highlighting engine searches for the lowest match in all subpatterns of html, in the region matched by the type 2 html pattern. Again, the lowest match will count. The pattern named html-tag has a match at position 1. This pattern is a type 3 pattern, so it matches a subpattern of the parent:
p
the match from subpattern html-tag ends at position 2 and it does not have any child patterns, so the highlighting engine continues at position 2 with all subpatterns from html. A type 2 pattern named html-attrib has the lowest match:
align="center"
This pattern does have a child pattern, again a type 3 pattern called html-attrib-sub2 matching:
"center"
The pattern html-attrib-sub2 does not have any child patterns, and subpatterns of html-attrib do not have any more matches, and also html subpatterns do not have any more matches. So we are back on the main level, the remaining code to highlight is:
<?php // this is a comment ?> ?>
Now a pattern named php has the lowest match. This is a type 0 pattern, so the highlight engine continues with all the remaining code, but it will not only search for the lowest match of the child patterns of php, but it will also use for the end pattern of php. The lowest match in this example is a pattern named php-comment-C++ As you can see the ?> within the comment does not end the php pattern, because it lies within a subpattern of php:
// this is a comment ?>
The pattern php-comment-C++ does not have any child patterns, so the remaining code for the php subpatterns is:
?>
It is very obvious now, the lowest match will be the end pattern of the php pattern, so we're back on the main level, and we have matched all of the code!
The config file for highlighting is a colon separated array with the following content:
mode: patternname: case_sensitive(0-on/1-off): start reg-ex: end reg-ex: start & end pattern(1), only start(2), subpattern(3): parent-match: foreground-color: background-color: don't change weight(0), non-bold(1), bold(2): don't change style(0), non-italic(1), italic(2):
The same options are found in the syntax highlighting preferences.
SCREENSHOT BY ????
Table of Contents
Obviously, this chapter needs some work.
get the latest CVS release (info on the development page)
use ./configure --with-debugging-output
make clean
make
do not run make install since it strips the debugging symbols from the executable
use 'gdb src/bluefish' to run bluefish in the debugger, do not run gdb bluefish or gdb /usr/local/bin/bluefish since these binaries do not have any debugging symbols anymore
type 'r' to start
reproduce the crash
copy & paste the last 50 lines of debugging output to an email
type 'bt' to get the backtrace info, and copy it also to the mail (if it is over 50 lines, the first lines of the backtrace info are the most interesting)
send the mail to the general address, the mailing list or a specific developer
Table of Contents
Work hard but have fun!
Indenting can be done with the indent utility. Bluefish uses tabs - not spaces, and I'll explain why. Some programmers prefer a lot of indenting, 8 characters, some prefer less, 3 characters. If Bluefish code was indented with spaces, these programmers had a problem, they would have to change the files to view it in their favourite layout. But because we use tabs, these programmers can simply set the tab width to a different value, and without changing the files it looks good for both programmers!
indent --line-length 100 --k-and-r-style --tab-size 4 -bbo --ignore-newlines bluefishcode.c
comment all public functions like it is done in bf_lib.c and gtk_easy.c (javadoc style, with some small differences), this can be used to create a function reference
for non-local functions, the name should preferably include a prefix that shows the part of bluefish it is used for. There are, furthermore, many often used abbreviations in the bluefish code, such as:
doc - a function for handling a specific document
bfwin - a function for handling a specific Bluefish window
cb - callback, a function called after a button click or some other event
lcb - local callback, a function called after an event, only used in this .c file
Example function names that show where they are from, what they handle, and/or what they do:
bmark_set_for_doc - bookmark code, sets bookmarks for a document
spell_check_cb - spell check code, this is a callback function (for a button)
project_open_from_file - project code, opens a new project from a given file name
All local functions should be static! Callback functions (called for events such as button clicks) should have prefix _cb, or _lcb for local callbacks.
for GTK callback functions, use the name of the signal in the name
Only functions that are used from outside the file itself should be in the header file, in the order in which they are found in the .c file itself. Basically these are all non-static functions in the .c file.
Before starting to code:
update your CVS tree, or alternatively download the latest snapshot
copy this original tree, so you can make a patch against this tree
Before creating the patch:
run make distclean && ./configure && make and test if it runs successfully
if you have the possibility do this both with gcc-2.95 and gcc-3. as compiler
Now create the patch. Suppose you have two directories, original-tree and my-tree
run make distclean in both trees
cd to the parent dir of both trees
run diff -Naur original-tree my-tree | bzip2 -9c > patchbla.diff.bz2
Table of Contents
Credits
Table of Contents
History
Table of Contents
The Bluefish manual is written in DocBook XML, which is a set of standards for writing documentation. Originally, DocBook was intended for computer software documentation, but is now used for many other document types.
To generate HTML or PDF files out of the source XML, you will need the following:
Bluefish Manual Source Files
DocBook Document Type Definition (DTD)
DocBook XSL stylesheets
XSLT Processor
To get the Bluefish XML source, we use cvs. To login:
$ cvs -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/bluefish login
You will be prompted for a password. Since we are logging in anonymously, you can just hit enter without providing any password. Next we will checkout the directory containing the Bluefish documentation:
$ cvs -z3 -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/bluefish co bluefish-gtk2/doc
This will download all the files to your system in the directory bluefish-gtk2/doc/. Next, we will get the DTD and the stylesheets, which are in CVS under bluefish-doctools:
$ cvs -z3 -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/bluefish co bluefish-gtk2/doc
Finally, you need the libxslt libraries installed on your system. libxslt is distributed as part of the GNOME desktop environment and is packaged for most Linux distributions. Fink provides the packages for Mac OS X. The XSLT processor xsltproc is provided by the libxslt library and is the command which will convert the DocBook source into HTML files.
The files must be in the right place.
To create a one-page HTML file: To break the sections into multiple pages with navigation links (a process known as chunking):
The DocBook rules are strict and must be maintained in order for the manual to build using xsltproc. However, there are some rules we like to follow to make editing the manual more efficient and organized.
All id names should begin with the name of the book. In our case the main book file is bluefish.xml, so every id should beging with bluefish.
Separate words in the id with hyphens.
Finally, include a word or two describing the content in the section. For example, a chapter entitled Using Bluefish would have the id bluefish-using. And, a section within that chapter called Keyboard Shortcuts could have the name bluefish-using-shortcuts.
The main thing is that all id's must be unique or processing will fail. Also, be careful when renaming id's, since the name could be used in links within other parts of the manual. It's best to do a global search for an id in all the manual's files before changing an id.
If you find errors in the manual, or just want to add more, please contact us. If you have questions on how to edit the manual that are not addressed in this appendix, you can always ask on the mailing list. Often, you can look to the chapter source to see how things are done.
Table of Contents
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification follow.
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. 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 PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice
This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.