## SwamiguiSplits SwamiguiSplits |

## Synopsis

                        SwamiguiSplitsEntry;
    #define             SWAMIGUI_SPLITS_WHITE_KEY_COUNT
    enum                SwamiguiSplitsMode;
    enum                SwamiguiSplitsStatus;
    enum                SwamiguiSplitsMoveFlags;
    gboolean            (*SwamiguiSplitsHandler)            (SwamiguiSplits *splits);
                        SwamiguiSplits;
    GtkWidget *         swamigui_splits_new                 (void);
    void                swamigui_splits_set_mode            (SwamiguiSplits *splits,
                                                             SwamiguiSplitsMode mode);
    void                swamigui_splits_set_width           (SwamiguiSplits *splits,
                                                             int width);
    void                swamigui_splits_set_selection       (SwamiguiSplits *splits,
                                                             IpatchList *items);
    IpatchList *        swamigui_splits_get_selection       (SwamiguiSplits *splits);
    void                swamigui_splits_select_items        (SwamiguiSplits *splits,
                                                             GList *items);
    void                swamigui_splits_select_all          (SwamiguiSplits *splits);
    void                swamigui_splits_unselect_all        (SwamiguiSplits *splits);
    void                swamigui_splits_item_changed        (SwamiguiSplits *splits);
    void                swamigui_splits_register_handler    (SwamiguiSplitsHandler handler);
    void                swamigui_splits_unregister_handler  (SwamiguiSplitsHandler handler);
    #define             swamigui_splits_add                 (splits, item)
    SwamiguiSplitsEntry * swamigui_splits_insert            (SwamiguiSplits *splits,
                                                             GObject *item,
                                                             int index);
    SwamiguiSplitsEntry * swamigui_splits_lookup_entry      (SwamiguiSplits *splits,
                                                             GObject *item);
    void                swamigui_splits_remove              (SwamiguiSplits *splits,
                                                             GObject *item);
    void                swamigui_splits_remove_all          (SwamiguiSplits *splits);
    void                swamigui_splits_set_span_range      (SwamiguiSplits *splits,
                                                             GObject *item,
                                                             int low,
                                                             int high);
    void                swamigui_splits_set_root_note       (SwamiguiSplits *splits,
                                                             GObject *item,
                                                             int val);
    SwamiControl *      swamigui_splits_entry_get_span_control
                                                            (SwamiguiSplitsEntry *entry);
    SwamiControl *      swamigui_splits_entry_get_root_note_control
                                                            (SwamiguiSplitsEntry *entry);
    int                 swamigui_splits_entry_get_index     (SwamiguiSplitsEntry *entry);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GtkBox
                                     +----GtkVBox
                                           +----SwamiguiSplits

## Implemented Interfaces

SwamiguiSplits implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Properties

      "item-selection"           IpatchList*           : Read / Write
      "piano"                    SwamiguiPiano*        : Read
      "splits-item"              IpatchItem*           : Read / Write

## Description

## Details

### SwamiguiSplitsEntry

    typedef struct _SwamiguiSplitsEntry SwamiguiSplitsEntry;

### SWAMIGUI_SPLITS_WHITE_KEY_COUNT

    #define SWAMIGUI_SPLITS_WHITE_KEY_COUNT 75

### enum SwamiguiSplitsMode

    typedef enum
    {
      SWAMIGUI_SPLITS_NOTE,
      SWAMIGUI_SPLITS_VELOCITY
    } SwamiguiSplitsMode;

### enum SwamiguiSplitsStatus

    typedef enum
    {
      SWAMIGUI_SPLITS_NORMAL,	/* no particular status */
      SWAMIGUI_SPLITS_INIT,		/* check selection and initialize splits */
      SWAMIGUI_SPLITS_MODE,		/* note/velocity mode change */
      SWAMIGUI_SPLITS_UPDATE,	/* selection changed */
      SWAMIGUI_SPLITS_CHANGED       /* splits-item changed */
    } SwamiguiSplitsStatus;

### enum SwamiguiSplitsMoveFlags

    typedef enum
    {
      SWAMIGUI_SPLITS_MOVE_RANGES = 1 << 0,
      SWAMIGUI_SPLITS_MOVE_PARAM1 = 1 << 1
    } SwamiguiSplitsMoveFlags;

`SWAMIGUI_SPLITS_MOVE_RANGES` | Move note ranges
`SWAMIGUI_SPLITS_MOVE_PARAM1` | Move parameter 1 (default is root notes)

### SwamiguiSplitsHandler ()

    gboolean            (*SwamiguiSplitsHandler)            (SwamiguiSplits *splits);

This function type is used to handle specific patch item types with note or velocity split parameters. The `splits` object `status` field indicates the current operation which is one of:

`SWAMIGUI_SPLITS_INIT` - Check selection and install splits and note pointers if the selection can be handled. Return `TRUE` if selection was handled, which will activate this handler, `FALSE` otherwise.

`SWAMIGUI_SPLITS_MODE` - Split mode change (from note to velocity mode for example). Re-configure splits and note pointers. Return `TRUE` if mode change was handled, `FALSE` otherwise which will de-activate this handler.

`SWAMIGUI_SPLITS_UPDATE` - Item selection has changed, update splits and note pointers. Return `TRUE` if selection change was handled, `FALSE` otherwise which will de-activate this handler.

Other useful fields of a SwamiguiSplits object include `mode` which defines the current mode (SwamiguiSplitsMode) and `selection` which defines the current item selection.

`splits` : | Splits object
Returns : | Should return `TRUE` if operation was handled, `FALSE` otherwise.

### SwamiguiSplits

    typedef struct {
      SwamiguiSplitsStatus status;	/* current status (for handlers) */
      int mode;			/* current mode (SWAMIGUI_SPLITS_NOTE or
    				   SWAMIGUI_SPLITS_VELOCITY) */
      int move_flags;		/* current move flags (SwamiguiSplitsMoveFlags) */
      IpatchList *selection;        /* selected items (parent OR child splits) */
      IpatchItem *splits_item;      /* active item which contains splits */
      SwamiguiSplitsHandler handler;	/* active splits handler or NULL */
      gpointer handler_data;	/* handler defined pointer */
    } SwamiguiSplits;

### swamigui_splits_new ()

    GtkWidget *         swamigui_splits_new                 (void);

Create new note/velocity splits widget.

Returns : | New splits widget.

### swamigui_splits_set_mode ()

    void                swamigui_splits_set_mode            (SwamiguiSplits *splits,
                                                             SwamiguiSplitsMode mode);

Set the mode of a splits object.

`splits` : | Splits object
`mode` : | Velocity or key mode enum

### swamigui_splits_set_width ()

    void                swamigui_splits_set_width           (SwamiguiSplits *splits,
                                                             int width);

Set the width of the splits widget in pixels.

`splits` : | Splits object
`width` : | Width in pixels

### swamigui_splits_set_selection ()

    void                swamigui_splits_set_selection       (SwamiguiSplits *splits,
                                                             IpatchList *items);

Set the items of a splits widget. The `items` list can contain an item that is a parent of items with split parameters (a SoundFont IpatchSF2Preset or IpatchSF2Inst for example) and/or a list of children split item's with the same parent (for example SoundFont IpatchSF2PZone items), any other selection list will de-activate the splits widget.

`splits` : | Splits object
`items` : | List of selected items (selected splits and/or the parent of split items) or `NULL` to unset selection.

### swamigui_splits_get_selection ()

    IpatchList *        swamigui_splits_get_selection       (SwamiguiSplits *splits);

Get the list of active items in a splits widget (a parent of split items and/or split items).

`splits` : | Splits widget
Returns : | New list containing splits with a ref count of one which the caller owns or `NULL` if no active splits.

### swamigui_splits_select_items ()

    void                swamigui_splits_select_items        (SwamiguiSplits *splits,
                                                             GList *items);

Set the list of splits currently selected. Usually only used by SwamiguiSplit handlers.

`splits` : | Splits widget
`items` : | List of objects to select (`NULL` to unselect all)

### swamigui_splits_select_all ()

    void                swamigui_splits_select_all          (SwamiguiSplits *splits);

Select all splits in a splits widget.

`splits` : | Splits widget

### swamigui_splits_unselect_all ()

    void                swamigui_splits_unselect_all        (SwamiguiSplits *splits);

Unselect all splits in a splits widget.

`splits` : | Splits widget

### swamigui_splits_item_changed ()

    void                swamigui_splits_item_changed        (SwamiguiSplits *splits);

Called to indicate that the active "splits-item" has changed and the splits should therefore be updated.

`splits` : | Splits widget

### swamigui_splits_register_handler ()

    void                swamigui_splits_register_handler    (SwamiguiSplitsHandler handler);

Registers a new handler for splits widgets. Split handlers interface patch item's of particular types with note/velocity split parameters and note pointer controls (such as a root note parameter).

MT: This function is multi-thread safe and can be called from outside of the GUI thread.

`handler` : | Splits handler function to register

### swamigui_splits_unregister_handler ()

    void                swamigui_splits_unregister_handler  (SwamiguiSplitsHandler handler);

Unregisters a handler previously registered with `swamigui_splits_register_handler()`.

MT: This function is multi-thread safe and can be called from outside of the GUI thread.

`handler` : | Handler function to unregister

### swamigui_splits_add()

    #define             swamigui_splits_add(splits, item)

### swamigui_splits_insert ()

    SwamiguiSplitsEntry * swamigui_splits_insert            (SwamiguiSplits *splits,
                                                             GObject *item,
                                                             int index);

Adds a new entry to a splits widget associated with a given object `item`. An entry is a place holder for a split range (key or velocity) and/or root note controls.

`splits` : | Splits widget
`item` : | Object for this split
`index` : | Index in list of existing splits in widget (-1 to append).
Returns : | Splits entry which is internal and should only be used with public accessor functions and should not be modified or freed.

### swamigui_splits_lookup_entry ()

    SwamiguiSplitsEntry * swamigui_splits_lookup_entry      (SwamiguiSplits *splits,
                                                             GObject *item);

### swamigui_splits_remove ()

    void                swamigui_splits_remove              (SwamiguiSplits *splits,
                                                             GObject *item);

Remove a split from a splits object by its associated object.

`splits` : | Splits widget
`item` : | Object of split to remove

### swamigui_splits_remove_all ()

    void                swamigui_splits_remove_all          (SwamiguiSplits *splits);

Remove all splits from a splits object.

`splits` : | Splits widget

### swamigui_splits_set_span_range ()

    void                swamigui_splits_set_span_range      (SwamiguiSplits *splits,
                                                             GObject *item,
                                                             int low,
                                                             int high);

A convenience function to set a span control range. One could also set this directly via the control.

`splits` : | Splits object
`item` : | Item of span to set
`low` : | Low value of span range
`high` : | High value of span range

### swamigui_splits_set_root_note ()

    void                swamigui_splits_set_root_note       (SwamiguiSplits *splits,
                                                             GObject *item,
                                                             int val);

A convenience function to set the root note value of a splits entry.

`splits` : | Splits widget
`item` : | Item of the splits entry to change the root note of
`val` : | MIDI root note value (0-127)

### swamigui_splits_entry_get_span_control ()

    SwamiControl *      swamigui_splits_entry_get_span_control
                                                            (SwamiguiSplitsEntry *entry);

### swamigui_splits_entry_get_root_note_control ()

    SwamiControl *      swamigui_splits_entry_get_root_note_control
                                                            (SwamiguiSplitsEntry *entry);

Get the root note control for a given splits entry. The root note control is created if it hasn't already been.

`entry` : | Splits entry pointer
Returns : | The root note control for the given `entry`. The control has not been referenced and is only valid while the GUI split exists.

### swamigui_splits_entry_get_index ()

    int                 swamigui_splits_entry_get_index     (SwamiguiSplitsEntry *entry);

## Property Details

### The `"item-selection"` property

      "item-selection"           IpatchList*           : Read / Write

Item selection.

### The `"piano"` property

      "piano"                    SwamiguiPiano*        : Read

Piano.

### The `"splits-item"` property

      "splits-item"              IpatchItem*           : Read / Write

Splits item.