~gryle-devel/gryle/trunk-deleted

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
HOWTO write plugins for Gryle
=============================

Writing plugins for Gryle is easy and fun!

Please note that when your plugin is compiled, it links against Gryle which is
licensed under the GNU General Public License. This means that your plugin must
be licensed under a GPL compatible license. Examples of such licenses are
at http://www.gnu.org/philosophy/license-list.html#GPLCompatibleLicenses

You should place your plugin file in the "plugins/" directory and name your
file along the lines of <Name>Plugin.java. In this guide, we will place the
plugin in MyPlugin.java.

Here is the beginning of MyPlugin.java:

import uk.org.wuglug.gryle.plugins.GrylePlugin;
public class MyPlugin extends GrylePlugin {
	@Override
	public String getName() {
		return "Example plugin";
	}
}

Plugins must extend the GrylePlugin class and implement the getName() method,
the return value of which is used by the user interface. Try to keep the name
as short as possible.

Gryle plugins work by receiving notification of events when they occur in
Gryle itself. Events include, startup, shutdown, when a song is played, when a
song is paused, etc. To recieve notification when Gryle starts up, simple
override the startupEventPerformed() method:

    public void startupEventPerformed() {
		System.out.println("Gryle is starting up!");		    
    }
    
To see your plugin in action, run "ant". This will compile and place all the
plugins in the necessary place and then run Gryle. Watch the command line
though - you should see the message "Gryle is starting up".

To see the other events that a plugin can recieve, see the Javadoc comments in
src/uk/org/wuglug/gryle/plugins/GrylePlugin.java

Some events include a reference to the currently playing song, which is of type
SongModel. To import this class, use the instruction:

import uk.org.wuglug.gryle.ui.m.SongModel;

Enjoy Gryle!

--The Gryle Developers.