summaryrefslogtreecommitdiff
path: root/src/nanolight.h
blob: 66bde5ab627ec94e39f5a7f07648afdcaadbc592 (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*
 * nanolight.h
 *
 * Copyright © 2019 Thomas White <taw@bitwiz.me.uk>
 *
 * This file is part of NanoLight.
 *
 * NanoLight 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 3 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, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef NANOLIGHT_H
#define NANOLIGHT_H

#include <gtk/gtk.h>

/* Fixture attributes */
#define INTENSITY    (1<<0)
#define COLOUR       (1<<1)
#define PANTILT      (1<<2)
#define FOCUS        (1<<3)
#define ZOOM         (1<<4)
#define FROST        (1<<5)
#define IRIS         (1<<6)
#define SHUTTERS     (1<<7)
#define GOBO         (1<<8)
#define GOBO_ROTATE  (1<<9)
#define GOBO_SPIN    (1<<10)
#define PRISM        (1<<11)
#define PRISM_ROTATE (1<<12)
#define PRISM_SPIN   (1<<13)

/* Fixture class properties */
#define COL_RGB  (1<<0)
#define COL_CMY  (1<<1)

/* Fixture properties */
#define REVERSE_PAN  (1<<0)
#define REVERSE_TILT  (1<<1)

struct fixture_class
{
	char *name;
	int properties;
	int attributes;
	int attributes16;

	int n_magic;
	int *magic_chans;
	int *magic_vals;

	int intensity_offset;
	int pan_offset;
	int tilt_offset;

	/* For CMY colour */
	int cyan_offset;
	int magenta_offset;
	int yellow_offset;

	/* For RGB colour */
	int red_offset;
	int green_offset;
	int blue_offset;

	int focus_offset;
	int zoom_offset;
	int frost_offset;
	int iris_offset;

	int n_gobos;   /* Number of gobos including "no gobo" */
	int n_gobo_chans;
	int *gobo_chans;
	int *gobo_vals;
	int *gobo_flags;
	int gobo_rotate_offset;
	int gobo_spin_offset;

	int n_prisms;
	int n_prism_chans;
	int *prism_chans;
	int *prism_vals;
	int *prism_flags;
	int prism_rotate_offset;
	int prism_spin_offset;
};


struct fixture
{
	char *label;
	int universe;
	int base_addr;
	struct fixture_class *cls;

	int flags;

	float intensity;      /* 0 (off) to 1 (full) */
	float cyan;           /* 0 (no filter) to 1 (full colour) */
	float magenta;        /* 0 (no filter) to 1 (full colour) */
	float yellow;         /* 0 (no filter) to 1 (full colour) */
	float red;            /* 0 (no red) to 1 (full on) */
	float green;          /* 0 (no green) to 1 (full on) */
	float blue;           /* 0 (no blue) to 1 (full on) */
	float pan;            /* -1 (fully stage left) to +1 (fully stage right) */
	float tilt;           /* -1 (fully downstage) to +1 (fully upstage) */
	int gobo;             /* Gobo number: 0 to cls->n_gobos-1 inclusive */
	float gobo_rotate;    /* -1 (fully anticlockwise) to +1 (fully clockwise) */
	float gobo_spin;      /* -1 (fastest anticlockwise) to +1 (fastest clockwise) */
	int prism;            /* Exactly like gobo */
	float prism_rotate;   /* Exactly like gobo_rotate */
	float prism_spin;     /* Exactly like gobo_spin */
	float focus;          /* 0 (nearest) to 1 (farthest) */
	float zoom;           /* 0 (narrowest) to 1 (widest) */
	float frost;          /* 0 (hardest) to 1 (softest) */
	float iris;           /* 0 (fully open) to 1 (fully closed) */

	/* Values at start of mouse movement */
	float pan_start;
	float tilt_start;
};


struct nanolight
{
	int n_fixtures;
	int max_fixtures;
	struct fixture *fixtures;

	GtkIMContext *im_context;
	GtkWidget *da;

	double fixture_width;

	char cmdline[1024];
	int cursor_idx;
	PangoLayout *layout;
	PangoLayout *sa_layout;

	int selection[1024];
	int n_sel;
	int sel_attr;
	int dragging;
	int fine;
	int go_lock;
	int sb_lock;

	double x_orig;
	double y_orig;
};

extern void attr_movex(struct nanolight *nl, signed int d, int fine);
extern void attr_movey(struct nanolight *nl, signed int d, int fine);


#endif	/* NANOLIGHT_H */