summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-06-11 22:47:55 +0200
committerThomas White <taw@physics.org>2019-06-11 23:21:03 +0200
commitb6e5f569f3d29dddc595c71bb00eba35983b0d03 (patch)
treeed108ea3d01a8228f749a612791ee576e5a32d04
parentcf59fc712b696c7d790e7da42d566b3b57f7dfce (diff)
Home button for pan/tilt
-rw-r--r--src/nanolight.c29
-rw-r--r--src/nanolight.h1
2 files changed, 30 insertions, 0 deletions
diff --git a/src/nanolight.c b/src/nanolight.c
index cffa48c..a9b3eab 100644
--- a/src/nanolight.c
+++ b/src/nanolight.c
@@ -344,6 +344,27 @@ static void update_mouse_orientation(struct nanolight *nl)
}
+static void home_value(struct nanolight *nl)
+{
+ int i;
+ for ( i=0; i<nl->n_sel; i++ ) {
+
+ struct fixture *fix = &nl->fixtures[nl->selection[i]];
+ int n;
+
+ if ( nl->mouse_orientation ) {
+ if ( find_attribute(fix, ATT_PAN, &n) ) {
+ fix->attr_vals[n] = fix->cls->attrs[n].home;
+ }
+ if ( find_attribute(fix, ATT_TILT, &n) ) {
+ fix->attr_vals[n] = fix->cls->attrs[n].home;
+ }
+ }
+
+ }
+}
+
+
static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event, struct nanolight *nl)
{
gboolean r;
@@ -389,6 +410,11 @@ static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event, struct nanoligh
claim = 1;
break;
+ case GDK_KEY_Home :
+ home_value(nl);
+ claim = 1;
+ break;
+
case GDK_KEY_F1 :
update_mouse_orientation(nl);
claim = 1;
@@ -485,14 +511,17 @@ int main(int argc, char *argv[])
cls.attrs[0].cls = ATT_INTENSITY;
cls.attrs[0].props = 0;
cls.attrs[0].addr_offset = 50;
+ cls.attrs[0].home = 0;
cls.attrs[1].cls = ATT_PAN;
cls.attrs[1].props = ATTR_16BIT;
cls.attrs[1].addr_offset = 0;
+ cls.attrs[1].home = 32768;
cls.attrs[2].cls = ATT_TILT;
cls.attrs[2].props = ATTR_16BIT;
cls.attrs[2].addr_offset = 2;
+ cls.attrs[2].home = 32768;
nl.fixture_width = 80.0;
nl.fixtures = NULL;
diff --git a/src/nanolight.h b/src/nanolight.h
index a7f7136..67db396 100644
--- a/src/nanolight.h
+++ b/src/nanolight.h
@@ -42,6 +42,7 @@ struct attribute
enum attr_class cls;
int props;
int addr_offset;
+ int home;
};