Only display OC Menu when protocol 1 or 2.
Remove couple of warnings when compiling on Mac.
}
static gboolean oc_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ g_print("oc_cb\n");
cleanup();
oc_menu(top_window);
return TRUE;
gtk_grid_attach(GTK_GRID(grid),dsp_b,(i%5),i/5,1,1);
i++;
- GtkWidget *oc_b=gtk_button_new_with_label("OC");
- g_signal_connect (oc_b, "button-press-event", G_CALLBACK(oc_cb), NULL);
- gtk_grid_attach(GTK_GRID(grid),oc_b,(i%5),i/5,1,1);
- i++;
+ if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
+ GtkWidget *oc_b=gtk_button_new_with_label("OC");
+ g_signal_connect (oc_b, "button-press-event", G_CALLBACK(oc_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),oc_b,(i%5),i/5,1,1);
+ i++;
+ }
GtkWidget *display_b=gtk_button_new_with_label("Display");
g_signal_connect (display_b, "button-press-event", G_CALLBACK(display_cb), NULL);
void oc_menu(GtkWidget *parent) {
int i,j;
+g_print("oc_menu: parent=%p\n",parent);
parent_window=parent;
dialog=gtk_dialog_new();
if(duplex) {
gtk_widget_show_all(transmitter->dialog);
+ if(transmitter->dialog_x!=-1 && transmitter->dialog_y!=-1) {
+ gtk_window_move(GTK_WINDOW(transmitter->dialog),transmitter->dialog_x,transmitter->dialog_y);
+ }
} else {
gtk_fixed_put(GTK_FIXED(fixed),transmitter->panel,transmitter->x,transmitter->y);
}
SetChannelState(transmitter->id,0,1);
tx_set_displaying(transmitter,0);
if(duplex) {
+ gtk_window_get_position(GTK_WINDOW(transmitter->dialog),&transmitter->dialog_x,&transmitter->dialog_y);
gtk_widget_hide(transmitter->dialog);
} else {
gtk_container_remove(GTK_CONTAINER(fixed), transmitter->panel);
row++;
- receivers_2=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(receivers_1),"2");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (receivers_2), receivers==2);
- gtk_grid_attach(GTK_GRID(grid),receivers_2,col,row,1,1);
- g_signal_connect(receivers_2,"toggled",G_CALLBACK(receivers_cb),(gpointer *)2);
- row++;
+ if(receivers>1) {
+ receivers_2=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(receivers_1),"2");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (receivers_2), receivers==2);
+ gtk_grid_attach(GTK_GRID(grid),receivers_2,col,row,1,1);
+ g_signal_connect(receivers_2,"toggled",G_CALLBACK(receivers_cb),(gpointer *)2);
+ row++;
+ }
+
col++;
if(row>temp_row) temp_row=row;
fprintf(stderr,"soapy_discovery\n");
rtlsdr_count=0;
SoapySDRKwargs *results = SoapySDRDevice_enumerate(NULL, &length);
-fprintf(stderr,"soapy_discovery: length=%d\n",length);
+fprintf(stderr,"soapy_discovery: length=%d\n",(int)length);
for (i = 0; i < length; i++) {
for (size_t j = 0; j < results[i].size; j++) {
if(strcmp(results[i].keys[j],"driver")==0 && strcmp(results[i].vals[j],"audio")!=0) {
SoapySDRDevice_closeStream(soapy_device,rx_stream);
fprintf(stderr,"soapy_protocol: receive_thread: SoapySDRDevice_unmake\n");
SoapySDRDevice_unmake(soapy_device);
+ return NULL;
}
void soapy_protocol_process_local_mic(float sample) {
sprintf(name,"transmitter.%d.xit",tx->id);
sprintf(value,"%lld",tx->xit);
setProperty(name,value);
+
+ sprintf(name,"transmitter.%d.dialog_x",tx->id);
+ sprintf(value,"%d",tx->dialog_x);
+ setProperty(name,value);
+ sprintf(name,"transmitter.%d.dialog_y",tx->id);
+ sprintf(value,"%d",tx->dialog_y);
+ setProperty(name,value);
}
void transmitter_restore_state(TRANSMITTER *tx) {
sprintf(name,"transmitter.%d.xit",tx->id);
value=getProperty(name);
if(value) tx->xit=atoll(value);
+ sprintf(name,"transmitter.%d.dialog_x",tx->id);
+ value=getProperty(name);
+ if(value) tx->dialog_x=atoi(value);
+ sprintf(name,"transmitter.%d.dialog_y",tx->id);
+ value=getProperty(name);
+ if(value) tx->dialog_y=atoi(value);
}
static double compute_power(double p) {
tx->xit_enabled=FALSE;
tx->xit=0LL;
+ tx->dialog_x=-1;
+ tx->dialog_y=-1;
+
transmitter_restore_state(tx);
int x;
int y;
+ int dialog_x;
+ int dialog_y;
+
} TRANSMITTER;
extern TRANSMITTER *create_transmitter(int id, int buffer_size, int fft_size, int fps, int width, int height);