Here is a short guide for people that want to add some tools to the K5KEditor NG
The K5KEditor NG is composed of 3 layers :
- the first one manages sysex communications, loads and saves files.
- the second one manages all the data logic (k5keditor.model)
- the third one manages the GUI (k5keditor.view).
Retreiving and managing K5000 data
- each K5KObject owns a K5KType (LFO, LEVELS, DCA, FORMANT_BAND,
...) that allows to retrieve a specific object with this uniq
information.
- ModelManager allows you do other actions : ModelManager.getInstance().copy(AbstractK5KObject), ModelManager.getInstance().paste(AbstractK5KObject), ModelManager.getInstance().load(AbstractK5KObject, File), ModelManager.getInstance().save(AbstractK5KObject, File).
- Once you have the desired K5KObject, you can access its data with
de getData(Index) and setData(index, Value) methods. When you call
setData(Index, value), the modified data is automaticaly send to the
SysexManager.
AbstractK5KObject object = ModelManager.getInstance().getToneModel();
Common common = new Common(object);
i18n
K5KEditor NG support the internationalization.
You just have to put your strings in k5keditor.i18n.i18n.properties for default name. You just have to add a file in your language to translate the K5KEditor. A k5keditor.i18n.i18n_fr_FR.properties will contain french translation.
To obtain the string in your language, just call Constant.getI18n("yourString").
Creating custom screen
The main Frame is called MainWindow. It handles K5kInternalFrames. A K5kInternalFrame shows K5KPanels.
- A K5kInternalFrame must contain two method : initGUI that places
all the K5KPanel and refreshData() that calls the refreshData() method
of the handled K5KPanels.
- A K5KPanel must contain 3 methods : initGUI that places all the
components (ComboBox, TextField, Histogram, ...).
refreshData() that refreshes all the components and refreshView() that
only refreshes histograms.
K5KPanel
To easily add components the K5KPanel contains several usefull methods :
- addTitle() that add a title
- addlabel() that add a label
- addInnerComponent that add a non final component in the line
- addFinalComponent that add a final component
- getComponent that create a ComboBox with all the needed listener
- getComponentAndUpdateView that create a ComboBox with all the needed listener and update the desired histogram
- setComponentPopupMenu that add a popup menu to a component.
Give a look at k5keditor.view.dco.DcoPanel
to understand how to create a simple screen with Integer values, String
values and an envelope automatically refreshed when you move your mouse
wheel over the attack time ComboBox.