diff --git a/common.c b/common.c index f5d5a4f..113bcaf 100644 --- a/common.c +++ b/common.c @@ -29,10 +29,10 @@ pthread_t thread1; GuiObjs gui; -GdkPixbuf *RxPixbuf = NULL; -GdkPixbuf *DispPixbuf = NULL; -GdkPixbuf *pixbufPWR = NULL; -GdkPixbuf *pixbufSNR = NULL; +GdkPixbuf *pixbuf_rx = NULL; +GdkPixbuf *pixbuf_disp = NULL; +GdkPixbuf *pixbuf_PWR = NULL; +GdkPixbuf *pixbuf_SNR = NULL; GtkListStore *savedstore = NULL; @@ -122,8 +122,8 @@ void evt_changeDevices() { // Clear received picture & metadata void evt_clearPix() { - gdk_pixbuf_fill (DispPixbuf, 0); - gtk_image_set_from_pixbuf(GTK_IMAGE(gui.image_rx), DispPixbuf); + gdk_pixbuf_fill (pixbuf_disp, 0); + gtk_image_set_from_pixbuf(GTK_IMAGE(gui.image_rx), pixbuf_disp); gtk_label_set_markup (GTK_LABEL(gui.label_fskid), ""); gtk_label_set_markup (GTK_LABEL(gui.label_utc), ""); gtk_label_set_markup (GTK_LABEL(gui.label_lastmode), ""); diff --git a/common.h b/common.h index f743296..2bfe93e 100644 --- a/common.h +++ b/common.h @@ -56,10 +56,10 @@ struct _GuiObjs { }; extern GuiObjs gui; -extern GdkPixbuf *pixbufPWR; -extern GdkPixbuf *pixbufSNR; -extern GdkPixbuf *RxPixbuf; -extern GdkPixbuf *DispPixbuf; +extern GdkPixbuf *pixbuf_PWR; +extern GdkPixbuf *pixbuf_SNR; +extern GdkPixbuf *pixbuf_rx; +extern GdkPixbuf *pixbuf_disp; extern GtkListStore *savedstore; @@ -102,27 +102,27 @@ typedef struct ModeSpecDef { extern ModeSpecDef ModeSpec[]; -void evt_AbortRx (); -void evt_changeDevices (); -void evt_chooseDir (); -void evt_clearPix (); guchar clip (double a); void createGUI (); double deg2rad (double Deg); -void evt_deletewindow (); double FindSync (guchar Mode, double Rate, int *Skip); -void evt_GetAdaptive (); void GetFSK (char *dest); bool GetVideo (guchar Mode, double Rate, int Skip, bool Redraw); guchar GetVIS (); guint GetBin (double Freq, guint FFTLen); int initPcmDevice (); void *Listen (); -void evt_ManualStart (); void populateDeviceList (); void readPcm (gint numsamples); -void setNewRxDir (); void setVU (short int PcmValue, double SNRdB); -void evt_show_about(); + +void evt_AbortRx (); +void evt_changeDevices (); +void evt_chooseDir (); +void evt_clearPix (); +void evt_deletewindow (); +void evt_GetAdaptive (); +void evt_ManualStart (); +void evt_show_about (); #endif diff --git a/gui.c b/gui.c index d87605f..0e4b01d 100644 --- a/gui.c +++ b/gui.c @@ -58,13 +58,13 @@ void createGUI() { savedstore = GTK_LIST_STORE(gtk_icon_view_get_model(GTK_ICON_VIEW(gui.iconview))); - RxPixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, false, 8, 320, 256); - gdk_pixbuf_fill(RxPixbuf, 0x000000ff); - DispPixbuf = gdk_pixbuf_scale_simple (RxPixbuf, 500, 400, GDK_INTERP_BILINEAR); - gtk_image_set_from_pixbuf(GTK_IMAGE(gui.image_rx), DispPixbuf); + pixbuf_rx = gdk_pixbuf_new (GDK_COLORSPACE_RGB, false, 8, 320, 256); + gdk_pixbuf_fill(pixbuf_rx, 0x000000ff); + pixbuf_disp = gdk_pixbuf_scale_simple (pixbuf_rx, 500, 400, GDK_INTERP_BILINEAR); + gtk_image_set_from_pixbuf(GTK_IMAGE(gui.image_rx), pixbuf_disp); - pixbufPWR = gdk_pixbuf_new (GDK_COLORSPACE_RGB, false, 8, 100, 20); - pixbufSNR = gdk_pixbuf_new (GDK_COLORSPACE_RGB, false, 8, 100, 20); + pixbuf_PWR = gdk_pixbuf_new (GDK_COLORSPACE_RGB, false, 8, 100, 20); + pixbuf_SNR = gdk_pixbuf_new (GDK_COLORSPACE_RGB, false, 8, 100, 20); gtk_combo_box_set_active(GTK_COMBO_BOX(gui.combo_mode), 0); @@ -88,11 +88,11 @@ void setVU (short int PcmValue, double SNRdB) { guchar *pixelsPWR, *pixelsSNR, *pPWR, *pSNR; unsigned int rowstridePWR,rowstrideSNR; - rowstridePWR = gdk_pixbuf_get_rowstride (pixbufPWR); - pixelsPWR = gdk_pixbuf_get_pixels (pixbufPWR); + rowstridePWR = gdk_pixbuf_get_rowstride (pixbuf_PWR); + pixelsPWR = gdk_pixbuf_get_pixels (pixbuf_PWR); - rowstrideSNR = gdk_pixbuf_get_rowstride (pixbufSNR); - pixelsSNR = gdk_pixbuf_get_pixels (pixbufSNR); + rowstrideSNR = gdk_pixbuf_get_rowstride (pixbuf_SNR); + pixelsSNR = gdk_pixbuf_get_pixels (pixbuf_SNR); for (y=0; y<20; y++) { for (x=0; x<100; x++) { @@ -127,8 +127,8 @@ void setVU (short int PcmValue, double SNRdB) { } gdk_threads_enter(); - gtk_image_set_from_pixbuf(GTK_IMAGE(gui.image_pwr), pixbufPWR); - gtk_image_set_from_pixbuf(GTK_IMAGE(gui.image_snr), pixbufSNR); + gtk_image_set_from_pixbuf(GTK_IMAGE(gui.image_pwr), pixbuf_PWR); + gtk_image_set_from_pixbuf(GTK_IMAGE(gui.image_snr), pixbuf_SNR); gdk_threads_leave(); } diff --git a/slowrx.c b/slowrx.c index d5da0ad..ab93a15 100644 --- a/slowrx.c +++ b/slowrx.c @@ -174,7 +174,7 @@ void *Listen() { HasSync = NULL; // Add thumbnail to iconview - thumbbuf = gdk_pixbuf_scale_simple (RxPixbuf, 100, + thumbbuf = gdk_pixbuf_scale_simple (pixbuf_rx, 100, 100.0/ModeSpec[Mode].ImgWidth * ModeSpec[Mode].ImgHeight * ModeSpec[Mode].YScale, GDK_INTERP_HYPER); gdk_threads_enter (); gtk_list_store_prepend (savedstore, &iter); @@ -202,7 +202,7 @@ void *Listen() { // Save the received image as PNG GdkPixbuf *scaledpb; - scaledpb = gdk_pixbuf_scale_simple (RxPixbuf, ModeSpec[Mode].ImgWidth, + scaledpb = gdk_pixbuf_scale_simple (pixbuf_rx, ModeSpec[Mode].ImgWidth, ModeSpec[Mode].ImgHeight * ModeSpec[Mode].YScale, GDK_INTERP_HYPER); ensure_dir_exists(g_key_file_get_string(keyfile,"slowrx","rxdir",NULL)); @@ -262,7 +262,7 @@ int main(int argc, char *argv[]) { fwrite(confdata,1,(size_t)keylen,ConfFile); fclose(ConfFile); - g_object_unref(RxPixbuf); + g_object_unref(pixbuf_rx); free(StoredLum); return (EXIT_SUCCESS); diff --git a/video.c b/video.c index cb56f57..98dd763 100644 --- a/video.c +++ b/video.c @@ -80,21 +80,21 @@ bool GetVideo(guchar Mode, double Rate, int Skip, bool Redraw) { // Initialize pixbuffer if (!Redraw) { - g_object_unref(RxPixbuf); - RxPixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, false, 8, ModeSpec[Mode].ImgWidth, ModeSpec[Mode].ImgHeight); - gdk_pixbuf_fill(RxPixbuf, 0); + g_object_unref(pixbuf_rx); + pixbuf_rx = gdk_pixbuf_new (GDK_COLORSPACE_RGB, false, 8, ModeSpec[Mode].ImgWidth, ModeSpec[Mode].ImgHeight); + gdk_pixbuf_fill(pixbuf_rx, 0); } - int rowstride = gdk_pixbuf_get_rowstride (RxPixbuf); + int rowstride = gdk_pixbuf_get_rowstride (pixbuf_rx); guchar *pixels, *p; - pixels = gdk_pixbuf_get_pixels(RxPixbuf); + pixels = gdk_pixbuf_get_pixels(pixbuf_rx); - g_object_unref(DispPixbuf); - DispPixbuf = gdk_pixbuf_scale_simple(RxPixbuf, 500, + g_object_unref(pixbuf_disp); + pixbuf_disp = gdk_pixbuf_scale_simple(pixbuf_rx, 500, 500.0/ModeSpec[Mode].ImgWidth * ModeSpec[Mode].ImgHeight * ModeSpec[Mode].YScale, GDK_INTERP_BILINEAR); gdk_threads_enter(); - gtk_image_set_from_pixbuf(GTK_IMAGE(gui.image_rx), DispPixbuf); + gtk_image_set_from_pixbuf(GTK_IMAGE(gui.image_rx), pixbuf_disp); gdk_threads_leave(); Length = ModeSpec[Mode].LineLen * ModeSpec[Mode].ImgHeight * 44100; @@ -373,12 +373,12 @@ bool GetVideo(guchar Mode, double Rate, int Skip, bool Redraw) { if (!Redraw || LineNum % 5 == 0 || LineNum == ModeSpec[Mode].ImgHeight-1) { // Scale and update image - g_object_unref(DispPixbuf); - DispPixbuf = gdk_pixbuf_scale_simple(RxPixbuf, 500, + g_object_unref(pixbuf_disp); + pixbuf_disp = gdk_pixbuf_scale_simple(pixbuf_rx, 500, 500.0/ModeSpec[Mode].ImgWidth * ModeSpec[Mode].ImgHeight * ModeSpec[Mode].YScale, GDK_INTERP_BILINEAR); gdk_threads_enter(); - gtk_image_set_from_pixbuf(GTK_IMAGE(gui.image_rx), DispPixbuf); + gtk_image_set_from_pixbuf(GTK_IMAGE(gui.image_rx), pixbuf_disp); gdk_threads_leave(); } }