From d4179a12792269f2af090d27a4307c6a570ef8a2 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 2 Jul 2019 22:37:15 +0200 Subject: Rename "struct nanolight" to "struct lightctx" --- meson.build | 1 + src/command.c | 10 ++-- src/command.h | 2 +- src/display.c | 32 +++++------ src/display.h | 2 +- src/lightctx.c | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lightctx.h | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/nanolight.c | 143 +---------------------------------------------- src/nanolight.h | 167 ------------------------------------------------------- src/scanout.c | 4 +- src/scanout.h | 2 +- 11 files changed, 361 insertions(+), 333 deletions(-) create mode 100644 src/lightctx.c create mode 100644 src/lightctx.h delete mode 100644 src/nanolight.h diff --git a/meson.build b/meson.build index d75170b..d647b04 100644 --- a/meson.build +++ b/meson.build @@ -21,6 +21,7 @@ soup_dep = dependency('libsoup-2.4', required : true) # Main program executable('nanolight', ['src/nanolight.c', + 'src/lightctx.c', 'src/command.c', 'src/scanout.c', 'src/display.c', diff --git a/src/command.c b/src/command.c index e60a75a..f1387b8 100644 --- a/src/command.c +++ b/src/command.c @@ -28,7 +28,7 @@ #include #define _(x) gettext(x) -#include "nanolight.h" +#include "lightctx.h" enum token_type { @@ -76,7 +76,7 @@ static int stop_char(char c) } -static int find_tokens(const char *cmd, struct token *tokens, struct nanolight *nl) +static int find_tokens(const char *cmd, struct token *tokens, struct lightctx *nl) { int i; int n = 0; @@ -160,7 +160,7 @@ static const char *str_attr(int att) return "???"; } -static void show_tokens(struct token *tokens, int n, struct nanolight *nl) +static void show_tokens(struct token *tokens, int n, struct lightctx *nl) { int i; @@ -199,7 +199,7 @@ static void show_tokens(struct token *tokens, int n, struct nanolight *nl) } -static void set_level(struct nanolight *nl, int val) +static void set_level(struct lightctx *nl, int val) { int i; @@ -210,7 +210,7 @@ static void set_level(struct nanolight *nl, int val) } -int command_run(const char *cmd, struct nanolight *nl) +int command_run(const char *cmd, struct lightctx *nl) { struct token tokens[1024]; int i, n; diff --git a/src/command.h b/src/command.h index 2d540d4..a2ca7d9 100644 --- a/src/command.h +++ b/src/command.h @@ -23,6 +23,6 @@ #ifndef COMMAND_H #define COMMAND_H -extern int command_run(const char *cmd, struct nanolight *nl); +extern int command_run(const char *cmd, struct lightctx *nl); #endif /* COMMAND_H */ diff --git a/src/display.c b/src/display.c index b61d847..5c27999 100644 --- a/src/display.c +++ b/src/display.c @@ -32,7 +32,7 @@ #include #define _(x) gettext(x) -#include "nanolight.h" +#include "lightctx.h" #include "command.h" #define OVERALL_BORDER (20.0) @@ -56,7 +56,7 @@ int key_attrs[] = { }; -static int fixture_selected(struct nanolight *nl, struct fixture *fix) +static int fixture_selected(struct lightctx *nl, struct fixture *fix) { int i; for ( i=0; in_sel; i++ ) { @@ -67,7 +67,7 @@ static int fixture_selected(struct nanolight *nl, struct fixture *fix) static void draw_fixture(cairo_t *cr, PangoContext *pc, PangoFontDescription *fontdesc, - struct nanolight *nl, struct fixture *fix) + struct lightctx *nl, struct fixture *fix) { PangoLayout *layout; const double w = 40.0; @@ -151,7 +151,7 @@ static const char *attr_text(int cls) } -static gboolean draw_sig(GtkWidget *widget, cairo_t *cr, struct nanolight *nl) +static gboolean draw_sig(GtkWidget *widget, cairo_t *cr, struct lightctx *nl) { int w, h; int ch; @@ -229,7 +229,7 @@ static gboolean draw_sig(GtkWidget *widget, cairo_t *cr, struct nanolight *nl) } -static void redraw(struct nanolight *nl) +static void redraw(struct lightctx *nl) { gint w, h; w = gtk_widget_get_allocated_width(GTK_WIDGET(nl->da)); @@ -238,7 +238,7 @@ static void redraw(struct nanolight *nl) } -static gboolean im_commit_sig(GtkIMContext *im, gchar *str, struct nanolight *nl) +static gboolean im_commit_sig(GtkIMContext *im, gchar *str, struct lightctx *nl) { size_t cmd_len = strlen(nl->cmdline); if ( cmd_len+strlen(str) > 1023 ) return FALSE; @@ -261,7 +261,7 @@ static size_t delete_char(char *str) } -static void set_start_pantilt(struct nanolight *nl) +static void set_start_pantilt(struct lightctx *nl) { int i; for ( i=0; in_sel; i++ ) { @@ -272,7 +272,7 @@ static void set_start_pantilt(struct nanolight *nl) } -static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event, struct nanolight *nl) +static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event, struct lightctx *nl) { #if 0 GdkSeat *seat; @@ -291,14 +291,14 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event, struct na } -static gboolean button_release_sig(GtkWidget *da, GdkEventButton *event, struct nanolight *nl) +static gboolean button_release_sig(GtkWidget *da, GdkEventButton *event, struct lightctx *nl) { nl->dragging = 0; return FALSE; } -static gboolean motion_sig(GtkWidget *da, GdkEventMotion *event, struct nanolight *nl) +static gboolean motion_sig(GtkWidget *da, GdkEventMotion *event, struct lightctx *nl) { int i; double x_inc, y_inc; @@ -341,7 +341,7 @@ static gboolean motion_sig(GtkWidget *da, GdkEventMotion *event, struct nanoligh } -static void home_value(struct nanolight *nl) +static void home_value(struct lightctx *nl) { int i; for ( i=0; in_sel; i++ ) { @@ -371,7 +371,7 @@ static void home_value(struct nanolight *nl) } -static void execute_command(struct nanolight *nl) +static void execute_command(struct lightctx *nl) { if ( command_run(nl->cmdline, nl) == 0 ) { nl->cmdline[0] = '\0'; @@ -381,7 +381,7 @@ static void execute_command(struct nanolight *nl) } -static gboolean key_release_sig(GtkWidget *da, GdkEventKey *event, struct nanolight *nl) +static gboolean key_release_sig(GtkWidget *da, GdkEventKey *event, struct lightctx *nl) { switch ( event->keyval ) { @@ -398,7 +398,7 @@ static gboolean key_release_sig(GtkWidget *da, GdkEventKey *event, struct nanoli } -static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event, struct nanolight *nl) +static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event, struct lightctx *nl) { gboolean r; int claim = 1; @@ -534,7 +534,7 @@ static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event, struct nanoligh } -static gint realise_sig(GtkWidget *da, struct nanolight *nl) +static gint realise_sig(GtkWidget *da, struct lightctx *nl) { GdkWindow *win = gtk_widget_get_window(da); PangoContext *pc; @@ -566,7 +566,7 @@ static gint realise_sig(GtkWidget *da, struct nanolight *nl) } -void create_main_window(struct nanolight *nl) +void create_main_window(struct lightctx *nl) { GtkWidget *mainwindow; GtkWidget *da; diff --git a/src/display.h b/src/display.h index eb4cb3e..9c42645 100644 --- a/src/display.h +++ b/src/display.h @@ -23,6 +23,6 @@ #ifndef DISPLAY_H #define DISPLAY_H -extern void create_main_window(struct nanolight *nl); +extern void create_main_window(struct lightctx *nl); #endif /* DISPLAY_H */ diff --git a/src/lightctx.c b/src/lightctx.c new file mode 100644 index 0000000..cbd5c24 --- /dev/null +++ b/src/lightctx.c @@ -0,0 +1,161 @@ +/* + * lightctx.c + * + * Copyright © 2019 Thomas White + * + * 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 . + * + */ + + +#include "lightctx.h" + + +struct fixture *create_fixture(struct lightctx *nl, struct fixture_class *cls, + const char *label, int universe, int base_addr, + int flags) +{ + struct fixture *fix; + + if ( nl->n_fixtures == nl->max_fixtures ) { + struct fixture *fixtures_new; + fixtures_new = realloc(nl->fixtures, (64+nl->max_fixtures)*sizeof(struct fixture)); + if ( fixtures_new == NULL ) return NULL; + nl->fixtures = fixtures_new; + nl->max_fixtures += 64; + } + + fix = &nl->fixtures[nl->n_fixtures++]; + fix->label = strdup(label); + fix->universe = universe; + fix->base_addr = base_addr; + fix->cls = cls; + fix->flags = flags; + + fix->intensity = 0.0; + fix->cyan = 0.0; + fix->magenta = 0.0; + fix->yellow = 0.0; + fix->red = 0.0; + fix->green = 0.0; + fix->blue = 0.0; + fix->pan = 0.0; + fix->tilt = 0.0; + fix->gobo = 0; + fix->gobo_rotate = 0.0; + fix->gobo_spin = 0.0; + fix->prism = 0; + fix->prism_rotate = 0.0; + fix->prism_spin = 0.0; + fix->focus = 0.5; + fix->zoom = 0.5; + fix->frost = 0.0; + + return fix; +} + + +static void cap_value(float *val, float min, float max) +{ + if ( *val > max ) *val = max; + if ( *val < min ) *val = min; +} + + +void attr_movex(struct lightctx *nl, signed int d, int fine) +{ + int i; + float chg = fine ? d/60000.0 : d/10.0; + if ( nl->sel_attr != PANTILT ) return; + for ( i=0; in_sel; i++ ) { + struct fixture *fix = &nl->fixtures[nl->selection[i]]; + if ( !(fix->cls->attributes & PANTILT) ) continue; + fix->pan += chg; + cap_value(&fix->pan, -1.0, 1.0); + } +} + + +void attr_movey(struct lightctx *nl, signed int d, int fine) +{ + int i; + float chg = fine ? d/60000.0 : d/10.0; + for ( i=0; in_sel; i++ ) { + struct fixture *fix = &nl->fixtures[nl->selection[i]]; + + switch ( nl->sel_attr ) { + + case PANTILT : + fix->tilt += chg; + cap_value(&fix->tilt, -1.0, 1.0); + break; + + case FOCUS : + fix->focus += chg; + cap_value(&fix->focus, 0.0, 1.0); + break; + + case ZOOM : + fix->zoom += chg; + cap_value(&fix->zoom, 0.0, 1.0); + break; + + case FROST : + fix->frost += chg; + cap_value(&fix->frost, 0.0, 1.0); + break; + + case IRIS : + fix->iris += chg; + cap_value(&fix->iris, 0.0, 1.0); + break; + + case GOBO : + if ( (fix->gobo == 0) && (d<0) ) continue; + if ( (fix->gobo == fix->cls->n_gobos-1) && (d>0) ) continue; + fix->gobo += d; + break; + + case GOBO_ROTATE : + fix->gobo_rotate += chg; + cap_value(&fix->gobo_rotate, -1.0, 1.0); + break; + + case GOBO_SPIN : + fix->gobo_spin += chg; + cap_value(&fix->gobo_spin, -1.0, 1.0); + break; + + case PRISM : + if ( (fix->prism == 0) && (d<0) ) continue; + if ( (fix->prism == fix->cls->n_prisms-1) && (d>0) ) continue; + fix->prism += d; + break; + + case PRISM_ROTATE : + fix->prism_rotate += chg; + cap_value(&fix->prism_rotate, -1.0, 1.0); + break; + + case PRISM_SPIN : + fix->prism_spin += chg; + cap_value(&fix->prism_spin, -1.0, 1.0); + break; + + } + + } +} diff --git a/src/lightctx.h b/src/lightctx.h new file mode 100644 index 0000000..8c25699 --- /dev/null +++ b/src/lightctx.h @@ -0,0 +1,170 @@ +/* + * nanolight.h + * + * Copyright © 2019 Thomas White + * + * 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 . + * + */ + +#ifndef LIGHTCTX_H +#define LIGHTCTX_H + +#include + +/* 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 lightctx +{ + 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 lightctx *nl, signed int d, int fine); +extern void attr_movey(struct lightctx *nl, signed int d, int fine); + +extern struct fixture *create_fixture(struct lightctx *nl, struct fixture_class *cls, + const char *label, int universe, int base_addr, + int flags); + +#endif /* LIGHTCTX_H */ diff --git a/src/nanolight.c b/src/nanolight.c index 42bd068..b78a6f8 100644 --- a/src/nanolight.c +++ b/src/nanolight.c @@ -32,7 +32,7 @@ #include #define _(x) gettext(x) -#include "nanolight.h" +#include "lightctx.h" #include "scanout.h" #include "display.h" @@ -44,153 +44,16 @@ static void show_help(const char *s) } -static struct fixture *create_fixture(struct nanolight *nl, struct fixture_class *cls, - const char *label, int universe, int base_addr, - int flags) -{ - struct fixture *fix; - - if ( nl->n_fixtures == nl->max_fixtures ) { - struct fixture *fixtures_new; - fixtures_new = realloc(nl->fixtures, (64+nl->max_fixtures)*sizeof(struct fixture)); - if ( fixtures_new == NULL ) return NULL; - nl->fixtures = fixtures_new; - nl->max_fixtures += 64; - } - - fix = &nl->fixtures[nl->n_fixtures++]; - fix->label = strdup(label); - fix->universe = universe; - fix->base_addr = base_addr; - fix->cls = cls; - fix->flags = flags; - - fix->intensity = 0.0; - fix->cyan = 0.0; - fix->magenta = 0.0; - fix->yellow = 0.0; - fix->red = 0.0; - fix->green = 0.0; - fix->blue = 0.0; - fix->pan = 0.0; - fix->tilt = 0.0; - fix->gobo = 0; - fix->gobo_rotate = 0.0; - fix->gobo_spin = 0.0; - fix->prism = 0; - fix->prism_rotate = 0.0; - fix->prism_spin = 0.0; - fix->focus = 0.5; - fix->zoom = 0.5; - fix->frost = 0.0; - - return fix; -} - - static gboolean scanout_cb(gpointer data) { - scanout_all((struct nanolight *)data); + scanout_all((struct lightctx *)data); return G_SOURCE_CONTINUE; } -static void cap_value(float *val, float min, float max) -{ - if ( *val > max ) *val = max; - if ( *val < min ) *val = min; -} - - -void attr_movex(struct nanolight *nl, signed int d, int fine) -{ - int i; - float chg = fine ? d/60000.0 : d/10.0; - if ( nl->sel_attr != PANTILT ) return; - for ( i=0; in_sel; i++ ) { - struct fixture *fix = &nl->fixtures[nl->selection[i]]; - if ( !(fix->cls->attributes & PANTILT) ) continue; - fix->pan += chg; - cap_value(&fix->pan, -1.0, 1.0); - } -} - - -void attr_movey(struct nanolight *nl, signed int d, int fine) -{ - int i; - float chg = fine ? d/60000.0 : d/10.0; - for ( i=0; in_sel; i++ ) { - struct fixture *fix = &nl->fixtures[nl->selection[i]]; - - switch ( nl->sel_attr ) { - - case PANTILT : - fix->tilt += chg; - cap_value(&fix->tilt, -1.0, 1.0); - break; - - case FOCUS : - fix->focus += chg; - cap_value(&fix->focus, 0.0, 1.0); - break; - - case ZOOM : - fix->zoom += chg; - cap_value(&fix->zoom, 0.0, 1.0); - break; - - case FROST : - fix->frost += chg; - cap_value(&fix->frost, 0.0, 1.0); - break; - - case IRIS : - fix->iris += chg; - cap_value(&fix->iris, 0.0, 1.0); - break; - - case GOBO : - if ( (fix->gobo == 0) && (d<0) ) continue; - if ( (fix->gobo == fix->cls->n_gobos-1) && (d>0) ) continue; - fix->gobo += d; - break; - - case GOBO_ROTATE : - fix->gobo_rotate += chg; - cap_value(&fix->gobo_rotate, -1.0, 1.0); - break; - - case GOBO_SPIN : - fix->gobo_spin += chg; - cap_value(&fix->gobo_spin, -1.0, 1.0); - break; - - case PRISM : - if ( (fix->prism == 0) && (d<0) ) continue; - if ( (fix->prism == fix->cls->n_prisms-1) && (d>0) ) continue; - fix->prism += d; - break; - - case PRISM_ROTATE : - fix->prism_rotate += chg; - cap_value(&fix->prism_rotate, -1.0, 1.0); - break; - - case PRISM_SPIN : - fix->prism_spin += chg; - cap_value(&fix->prism_spin, -1.0, 1.0); - break; - - } - - } -} - - int main(int argc, char *argv[]) { - struct nanolight nl; + struct lightctx nl; struct fixture_class cls; int c; diff --git a/src/nanolight.h b/src/nanolight.h deleted file mode 100644 index 66bde5a..0000000 --- a/src/nanolight.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * nanolight.h - * - * Copyright © 2019 Thomas White - * - * 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 . - * - */ - -#ifndef NANOLIGHT_H -#define NANOLIGHT_H - -#include - -/* 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 */ diff --git a/src/scanout.c b/src/scanout.c index 57a03da..ce7bfc9 100644 --- a/src/scanout.c +++ b/src/scanout.c @@ -26,7 +26,7 @@ #include #include -#include "nanolight.h" +#include "lightctx.h" static void set_val(int *dmx, int base_addr, int attr_offset, float value, int sixteenbit) { @@ -98,7 +98,7 @@ static void set_gobo(int *dmx, struct fixture *fix, int gobo) } -int scanout_all(struct nanolight *nl) +int scanout_all(struct lightctx *nl) { SoupSession *sess; SoupMessage *msg; diff --git a/src/scanout.h b/src/scanout.h index b474112..379b63f 100644 --- a/src/scanout.h +++ b/src/scanout.h @@ -23,6 +23,6 @@ #ifndef SCANOUT_H #define SCANOUT_H -extern int scanout_all(struct nanolight *nl); +extern int scanout_all(struct lightctx *nl); #endif /* SCANOUT_H */ -- cgit v1.2.3