From 925068aa12238c17c903e982f9cdfa4d6670f62b Mon Sep 17 00:00:00 2001 From: c vw Date: Wed, 15 Jan 2020 15:47:44 +0100 Subject: [PATCH] fixes to make cppcheck happier. --- meter.c | 8 ++++---- receiver.c | 38 ++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/meter.c b/meter.c index f0d5305..01a60eb 100644 --- a/meter.c +++ b/meter.c @@ -249,8 +249,8 @@ if(analog_meter) { double y; double angle; double radians; - double cx=(double)meter_width/2.0; - double cy=(double)meter_width/2.0; + double cx=(double)meter_width/2.0; // cx == cy throughout + double cy=(double)meter_width/2.0; // cx == cy throughout double radius=cy-20.0; cairo_set_line_width(cr, 1.0); @@ -355,8 +355,8 @@ if(analog_meter) { double y; double angle; double radians; - double cx=(double)meter_width/2.0; - double cy=(double)meter_width/2.0; + double cx=(double)meter_width/2.0; // cx == cy throughout + double cy=(double)meter_width/2.0; // cx == cy throughout double radius=cy-20.0; cairo_set_line_width(cr, 1.0); diff --git a/receiver.c b/receiver.c index 717f15e..fb8ce25 100644 --- a/receiver.c +++ b/receiver.c @@ -509,26 +509,28 @@ fprintf(stderr,"receiver_restore_state: id=%d\n",rx->id); void reconfigure_receiver(RECEIVER *rx,int height) { int y=0; + // + // myheight is the size of the waterfall or the panadapter + // which is the full or half of the height depending on whether BOTH + // are displayed + // + int myheight=(rx->display_panadapter && rx->display_waterfall) ? height/2 : height; - rx->height=height; + rx->height=height; // total height if(rx->display_panadapter) { - int height=rx->height; - if(rx->display_waterfall) { - height=height/2; - } if(rx->panadapter==NULL) { -fprintf(stderr,"reconfigure_receiver: panadapter_init: width:%d height:%d\n",rx->width,height); - rx_panadapter_init(rx, rx->width,height); - gtk_fixed_put(GTK_FIXED(rx->panel),rx->panadapter,0,y); +fprintf(stderr,"reconfigure_receiver: panadapter_init: width:%d height:%d\n",rx->width,myheight); + rx_panadapter_init(rx, rx->width,myheight); + gtk_fixed_put(GTK_FIXED(rx->panel),rx->panadapter,0,y); // y=0 here always } else { // set the size -//fprintf(stderr,"reconfigure_receiver: panadapter set_size_request: width:%d height:%d\n",rx->width,height); - gtk_widget_set_size_request(rx->panadapter, rx->width, height); +//fprintf(stderr,"reconfigure_receiver: panadapter set_size_request: width:%d height:%d\n",rx->width,myheight); + gtk_widget_set_size_request(rx->panadapter, rx->width, myheight); // move the current one gtk_fixed_move(GTK_FIXED(rx->panel),rx->panadapter,0,y); } - y+=height; + y+=myheight; } else { if(rx->panadapter!=NULL) { gtk_container_remove(GTK_CONTAINER(rx->panel),rx->panadapter); @@ -538,18 +540,14 @@ fprintf(stderr,"reconfigure_receiver: panadapter_init: width:%d height:%d\n",rx- } if(rx->display_waterfall) { - int height=rx->height; - if(rx->display_panadapter) { - height=height/2; - } if(rx->waterfall==NULL) { -fprintf(stderr,"reconfigure_receiver: waterfall_init: width:%d height:%d\n",rx->width,height); - waterfall_init(rx,rx->width,height); - gtk_fixed_put(GTK_FIXED(rx->panel),rx->waterfall,0,y); +fprintf(stderr,"reconfigure_receiver: waterfall_init: width:%d height:%d\n",rx->width,myheight); + waterfall_init(rx,rx->width,myheight); + gtk_fixed_put(GTK_FIXED(rx->panel),rx->waterfall,0,y); // y=0 if ONLY waterfall is present } else { // set the size -fprintf(stderr,"reconfigure_receiver: waterfall set_size_request: width:%d height:%d\n",rx->width,height); - gtk_widget_set_size_request(rx->waterfall, rx->width, height); +fprintf(stderr,"reconfigure_receiver: waterfall set_size_request: width:%d height:%d\n",rx->width,myheight); + gtk_widget_set_size_request(rx->waterfall, rx->width, myheight); // move the current one gtk_fixed_move(GTK_FIXED(rx->panel),rx->waterfall,0,y); } -- 2.45.2