BtPatternEditor

BtPatternEditor — the pattern editor widget

Functions

Properties

guint cursor-digit Read / Write
guint cursor-group Read / Write
guint cursor-param Read / Write
guint cursor-row Read / Write
guint octave Write
gdouble play-position Write

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── BtPatternEditor

Implemented Interfaces

BtPatternEditor implements AtkImplementorIface, GtkBuildable and GtkScrollable.

Includes

#include "bt-edit.h"

Description

Provides an editor widget for BtPattern instances.

Functions

bt_pattern_editor_new ()

GtkWidget *
bt_pattern_editor_new (void);

Create a new pattern editor widget. Use bt_pattern_editor_set_pattern() to pass pattern data.

Returns

the widget


bt_pattern_editor_set_pattern ()

void
bt_pattern_editor_set_pattern (BtPatternEditor *self,
                               gpointer pattern_data,
                               guint num_rows,
                               guint num_groups,
                               BtPatternEditorColumnGroup *groups,
                               BtPatternEditorCallbacks *cb);

Set pattern data to show in the widget.

Parameters

self

the widget

 

pattern_data

memory block of values (passed to the callbacks)

 

num_rows

number of tick rows (y axis)

 

num_groups

number of groups (x axis)

 

groups

group parameters

 

cb

value transformation callbacks

 

bt_pattern_editor_get_selection ()

gboolean
bt_pattern_editor_get_selection (BtPatternEditor *self,
                                 gint *start,
                                 gint *end,
                                 gint *group,
                                 gint *param);

Get selection rectangle.

Parameters

self

the widget

 

start

location for start tick

 

end

location for end tick

 

group

location for group

 

param

location for parameter in group

 

Returns

TRUE if there was a selection.


bt_pattern_editor_position_to_coords ()

gboolean
bt_pattern_editor_position_to_coords (BtPatternEditor *self,
                                      gint x,
                                      gint y,
                                      gint *row,
                                      gint *group,
                                      gint *parameter,
                                      gint *digit);

Get data coordinates for the mouse position. All out variables must not be NULL.

Parameters

self

the widget

 

x

x position of the mouse

 

y

y position of the mouse

 

row

location for start tick

 

group

location for group

 

parameter

location for parameter in group

 

digit

location for the digit in parameter

 

Returns

TRUE if we selected a position.

Types and Values

struct BtPatternEditor

struct BtPatternEditor;

Opaque editor instance data.


BtPatternEditorCallbacks

typedef struct {
  /* FIXME(ensonic): what about supplying
   * - BtPatternEditorColumn instead of BtPatternEditorColumn->user_data
   * - BtPatternEditorColumnGroup instead of track;
   */
  gfloat (*get_data_func)(gpointer pattern_data, gpointer column_data, guint row, guint group, guint param);
  void (*set_data_func)(gpointer pattern_data, gpointer column_data, guint row, guint group, guint param, guint digit, gfloat value);
} BtPatternEditorCallbacks;

Data format conversion callbacks.

Members

get_data_func ()

called to fetch data from the model and convert for view

 

set_data_func ()

called to convert from view format for storage in the model

 

BtPatternEditorColumn

typedef struct {
  BtPatternEditorColumnType type;
  float def, min, max;
  gpointer user_data;
} BtPatternEditorColumn;

A parameter column.

Members

BtPatternEditorColumnType type;

column value type

 

float def;

default value

 

float min;

minimum allowed value

 

float max;

maximum allowed value

 

gpointer user_data;

extra data to attach

 

enum BtPatternEditorColumnType

Column data types.

Members

PCT_NOTE

musical notes

 

PCT_SWITCH

on/off switches

 

PCT_BYTE

8bit values

 

PCT_WORD

16bit value

 

PCT_FLOAT

single precission floating point values

 

BtPatternEditorColumnGroup

typedef struct {
  // can be used for the headline above the group
  gchar *name;
  guint num_columns;
  BtPatternEditorColumn *columns;
  /* user_data for main-page-patterns */
  BtValueGroup *vg;
  gchar *fmt;
} BtPatternEditorColumnGroup;

A group of BtPatternEditorColumns, such as a voice or all global parameters.

Members

gchar *name;

group name

 

guint num_columns;

number of columns

 

BtPatternEditorColumn *columns;

array of columns

 

BtValueGroup *vg;

extra data for main-page-patterns

 

gchar *fmt;

extra data for main-page-patterns

 

enum BtPatternEditorSelectionMode

Seleting single columns, whole groups (e.g. voices) or the whole pattern.

Members

PESM_COLUMN

a single columns

 

PESM_GROUP

a whole group

 

PESM_ALL

all columns (and groups)

 

Property Details

The “cursor-digit” property

  “cursor-digit”             guint

The current digit of the parameter the cursor is at.

Flags: Read / Write

Allowed values: <= 3

Default value: 0


The “cursor-group” property

  “cursor-group”             guint

The current group the cursor is in.

Flags: Read / Write

Default value: 0


The “cursor-param” property

  “cursor-param”             guint

The current parameter the cursor is at.

Flags: Read / Write

Default value: 0


The “cursor-row” property

  “cursor-row”               guint

The current cursor row.

Flags: Read / Write

Default value: 0


The “octave” property

  “octave”                   guint

The octave for note input.

Flags: Write

Allowed values: <= 12

Default value: 2


The “play-position” property

  “play-position”            gdouble

The current playing position as a fraction.

Flags: Write

Allowed values: [-1,1]

Default value: -1

See Also

BtPattern, BtMainPagePatterns