]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Fixed zoom display bug.
authorJohn Melton G0ORX <john.d.melton@googlemail.com>
Tue, 17 Mar 2020 22:31:47 +0000 (22:31 +0000)
committerJohn Melton G0ORX <john.d.melton@googlemail.com>
Tue, 17 Mar 2020 22:31:47 +0000 (22:31 +0000)
PS Menu not shown when not protocol 1 or protocol 2.

new_menu.c
receiver.c
zoompan.c

index 7b2b2735d21944098691116dd0b7c2288bb85a7d..f520c8d53bb591af0d9d19a5088c7a6b99329eb0 100644 (file)
@@ -527,10 +527,12 @@ void new_menu()
       i++;
 
 #ifdef PURESIGNAL
-      GtkWidget *ps_b=gtk_button_new_with_label("PS");
-      g_signal_connect (ps_b, "button-press-event", G_CALLBACK(ps_cb), NULL);
-      gtk_grid_attach(GTK_GRID(grid),ps_b,(i%5),i/5,1,1);
-      i++;
+      if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
+        GtkWidget *ps_b=gtk_button_new_with_label("PS");
+        g_signal_connect (ps_b, "button-press-event", G_CALLBACK(ps_cb), NULL);
+        gtk_grid_attach(GTK_GRID(grid),ps_b,(i%5),i/5,1,1);
+        i++;
+      }
 #endif
 
       GtkWidget *pa_b=gtk_button_new_with_label("PA");
index 583cc325dcc05c307edef9d32fbe0e5e55834229..acb6f9af9ee51093a65e14700ae2d476e0ad8ac4 100644 (file)
@@ -1351,7 +1351,9 @@ void full_rx_buffer(RECEIVER *rx) {
   }
 
   if(rx->displaying) {
+    g_mutex_lock(&rx->display_mutex);
     Spectrum0(1, rx->id, 0, 0, rx->iq_input_buffer);
+    g_mutex_unlock(&rx->display_mutex);
   }
 
 //g_print("full_rx_buffer: rx=%d buffer_size=%d samples=%d\n",rx->id,rx->buffer_size,rx->samples);
@@ -1385,14 +1387,14 @@ void add_div_iq_samples(RECEIVER *rx, double i0, double q0, double i1, double q1
 }
 
 void receiver_change_zoom(RECEIVER *rx,double zoom) {
-  g_mutex_lock(&rx->display_mutex);
   if(rx->pixel_samples!=NULL) {
     g_free(rx->pixel_samples);
   }
   rx->pixels=rx->width*(int)zoom;
   rx->pixel_samples=g_new(float,rx->pixels);
   rx->hz_per_pixel=(double)rx->sample_rate/(double)rx->pixels;
-  if(zoom==0) {
+  rx->zoom=(int)zoom;
+  if(rx->zoom==1) {
     rx->pan=0;
   } else {
     if(vfo[rx->id].ctun) {
@@ -1404,14 +1406,12 @@ void receiver_change_zoom(RECEIVER *rx,double zoom) {
       rx->pan=(rx->pixels/2)-(rx->width/2);
     }
   }
-  rx->zoom=(int)zoom;
   init_analyzer(rx);
-  g_mutex_unlock(&rx->display_mutex);
 }
 
 void receiver_change_pan(RECEIVER *rx,double pan) {
-  g_mutex_lock(&rx->display_mutex);
-  rx->pan=(int)pan;
-  g_mutex_unlock(&rx->display_mutex);
+  if(rx->zoom>1) {
+    rx->pan=(int)pan;
+  }
 }
 
index 13173bf47c5acbb636325cc464805f0739f65015..0200ae1897c53629d0f5ef0a5ca691e208a38c8b 100644 (file)
--- a/zoompan.c
+++ b/zoompan.c
@@ -1,5 +1,5 @@
 /* Copyright (C)
-* 2015 - John Melton, G0ORX/N6LYT
+* 2020 - John Melton, G0ORX/N6LYT
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 *
 */
 
-//
-// DL1YCF:
-// uncomment the #define line following, then you will get
-// a "TX compression" slider with an enabling checkbox
-// in the bottom right of the sliders area, instead of the
-// sequelch slider and checkbox.
-// This option can also be passed to the compiler with "-D"
-// and thus be activated through the Makefile.
-//
-//#define COMPRESSION_SLIDER_INSTEAD_OF_SQUELCH 1
-//
-
 #include <gtk/gtk.h>
 #include <semaphore.h>
 #include <stdio.h>
@@ -67,14 +55,16 @@ int zoompan_active_receiver_changed(void *data) {
 }
 
 static void zoom_value_changed_cb(GtkWidget *widget, gpointer data) {
+  g_mutex_lock(&active_receiver->display_mutex);
   receiver_change_zoom(active_receiver,gtk_range_get_value(GTK_RANGE(zoom_scale)));
   gtk_range_set_range(GTK_RANGE(pan_scale),0.0,(double)(active_receiver->zoom==1?active_receiver->pixels:active_receiver->pixels-active_receiver->width));
   gtk_range_set_value (GTK_RANGE(pan_scale),active_receiver->pan);
-  if(active_receiver->zoom == 1) {
+  if(active_receiver->zoom==1) {
     gtk_widget_set_sensitive(pan_scale, FALSE);
   } else {
     gtk_widget_set_sensitive(pan_scale, TRUE);
   }
+  g_mutex_unlock(&active_receiver->display_mutex);
   vfo_update();
 }
 
@@ -125,7 +115,6 @@ static void pan_value_changed_cb(GtkWidget *widget, gpointer data) {
 }
 
 void set_pan(int rx,double value) {
-g_print("set_pan: %f\n",value);
   receiver[rx]->pan=(int)value;
   if(display_zoompan) {
     gtk_range_set_value (GTK_RANGE(pan_scale),receiver[rx]->pan);