-
Notifications
You must be signed in to change notification settings - Fork 2
/
receiver.c
134 lines (117 loc) · 3.45 KB
/
receiver.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/**
* @file receiver.c
* @brief Mode functions
* @author John Melton, G0ORX/N6LYT, Doxygen Comments Dave Larsen, KV0S
* @version 0.1
* @date 2009-04-12
*/
// receiver.c
/* Copyright (C)
* 2009 - John Melton, G0ORX/N6LYT, Doxygen Comments Dave Larsen, KV0S
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <getopt.h>
#include "property.h"
#include "screensize.h"
#include "command.h"
#include "main.h"
#include "wdsp.h"
#include "channel.h"
GtkWidget* receiverFrame;
int receiver;
float pan;
GtkWidget* panScale;
/* --------------------------------------------------------------------------*/
/**
* @brief Select the receiver
*
* @param widget
*/
void selectReceiver(GtkWidget* widget) {
GtkWidget* label;
char temp[80];
}
/* --------------------------------------------------------------------------*/
/**
* @brief Callback when pan values changes
*
* @param widget
* @param data
*/
void panChanged(GtkWidget* widget,gpointer data) {
pan=gtk_range_get_value((GtkRange*)panScale);
if(running) {
SetRXAPanelPan(CHANNEL_RX0, 1.0-pan);
}
}
/* --------------------------------------------------------------------------*/
/**
* @brief Build the GUI
*
* @return
*/
GtkWidget* buildReceiverUI() {
GtkWidget* label;
receiverFrame=gtk_frame_new("AF Pan");
gtk_widget_modify_bg(receiverFrame,GTK_STATE_NORMAL,&background);
gtk_widget_modify_fg(gtk_frame_get_label_widget(GTK_FRAME(receiverFrame)),GTK_STATE_NORMAL,&white);
panScale=gtk_hscale_new_with_range(0.0,1.0,0.1);
g_signal_connect(G_OBJECT(panScale),"value-changed",G_CALLBACK(panChanged),NULL);
gtk_range_set_value((GtkRange*)panScale,pan);
#ifdef NETBOOK
gtk_widget_set_size_request(GTK_WIDGET(panScale),75,25);
#else
gtk_widget_set_size_request(GTK_WIDGET(panScale),150,25);
#endif
gtk_widget_show(panScale);
gtk_container_add(GTK_CONTAINER(receiverFrame),panScale);
#ifdef NETBOOK
gtk_widget_set_size_request(GTK_WIDGET(receiverFrame),89,70);
#else
gtk_widget_set_size_request(GTK_WIDGET(receiverFrame),200,55);
#endif
gtk_widget_show(receiverFrame);
if(running) {
SetRXAPanelPan(CHANNEL_RX0, 1.0-pan);
}
return receiverFrame;
}
/* --------------------------------------------------------------------------*/
/**
* @brief Save the receiver state
*/
void receiverSaveState() {
char string[128];
sprintf(string,"%f",pan);
setProperty("pan",string);
}
/* --------------------------------------------------------------------------*/
/**
* @brief Restore the receiver state
*/
void receiverRestoreState() {
char* value;
value=getProperty("pan");
if(value) pan=atof(value); else pan=0.5f;
}