summaryrefslogtreecommitdiff
path: root/src/nanolight.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nanolight.c')
-rw-r--r--src/nanolight.c53
1 files changed, 49 insertions, 4 deletions
diff --git a/src/nanolight.c b/src/nanolight.c
index df93495..246cce1 100644
--- a/src/nanolight.c
+++ b/src/nanolight.c
@@ -451,7 +451,11 @@ static gboolean motion_sig(GtkWidget *da, GdkEventMotion *event, struct nanoligh
event->state & GDK_SHIFT_MASK);
signed int nv = fix->attr_vals_start[n] + inc;
cap_value(fix, n, &nv);
- fix->attr_vals[n] = nv;
+ if ( !(fix->cls->attrs[n].props & ATTR_STOP) ) {
+ fix->attr_vals[n] = nv;
+ } else {
+ printf("Can't change step attr with mouse\n");
+ }
}
}
}
@@ -461,6 +465,30 @@ static gboolean motion_sig(GtkWidget *da, GdkEventMotion *event, struct nanoligh
}
+static void change_stop_attr(struct nanolight *nl, signed int inc)
+{
+ int i;
+ for ( i=0; i<nl->n_sel; i++ ) {
+
+ struct fixture *fix = &nl->fixtures[nl->selection[i]];
+ int n;
+
+ if ( find_attribute(fix, nl->sel_attr, &n) ) {
+ if ( !(fix->cls->attrs[n].props & ATTR_STOP) ) {
+ printf("Can't change continuous attr with keys\n");
+ continue;
+ }
+ if ( (fix->attr_vals[n] == 0) && (inc < 0) ) continue;
+ if ( (fix->attr_vals[n] == fix->cls->attrs[n].n_stops-1) && (inc > 0) ) {
+ continue;
+ }
+ fix->attr_vals[n] += inc;
+ }
+
+ }
+ redraw(nl);
+}
+
static void home_value(struct nanolight *nl)
{
int i;
@@ -501,6 +529,14 @@ static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event, struct nanoligh
case GDK_KEY_Right :
break;
+ case GDK_KEY_Up :
+ change_stop_attr(nl, +1);
+ break;
+
+ case GDK_KEY_Down :
+ change_stop_attr(nl, -1);
+ break;
+
case GDK_KEY_Return :
execute_command(nl);
break;
@@ -725,10 +761,13 @@ int main(int argc, char *argv[])
cls.attrs[6].addr_offset = 12;
cls.attrs[6].home = 0;
+ int rgobo_stops[] = {0, 6, 10, 15, 19, 24, 28};
cls.attrs[7].cls = ATT_RGOBO;
- cls.attrs[7].props = 0;
+ cls.attrs[7].props = ATTR_STOP;
cls.attrs[7].addr_offset = 24;
cls.attrs[7].home = 0;
+ cls.attrs[7].stops = rgobo_stops;
+ cls.attrs[7].home = 7;
cls.attrs[8].cls = ATT_ZOOM;
cls.attrs[8].props = ATTR_16BIT;
@@ -740,15 +779,21 @@ int main(int argc, char *argv[])
cls.attrs[9].addr_offset = 34;
cls.attrs[9].home = 0;
+ int gobo_stops[] = {0, 67, 73, 78, 84, 89, 95, 100, 106};
cls.attrs[10].cls = ATT_GOBO;
- cls.attrs[10].props = 0;
+ cls.attrs[10].props = ATTR_STOP;
cls.attrs[10].addr_offset = 22;
cls.attrs[10].home = 0;
+ cls.attrs[10].stops = gobo_stops;
+ cls.attrs[10].n_stops = 9;
+ int prism_stops[] = {0, 50};
cls.attrs[11].cls = ATT_PRISM;
- cls.attrs[11].props = 0;
+ cls.attrs[11].props = ATTR_STOP;
cls.attrs[11].addr_offset = 27;
cls.attrs[11].home = 0;
+ cls.attrs[11].stops = prism_stops;
+ cls.attrs[11].n_stops = 2;
nl.fixture_width = 80.0;
nl.fixtures = NULL;