File: callbacks.c

package info (click to toggle)
baycomepp 0.10-18
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,696 kB
  • sloc: ansic: 32,210; sh: 3,795; makefile: 436; sed: 93; perl: 31; asm: 18
file content (98 lines) | stat: -rw-r--r-- 1,916 bytes parent folder | download | duplicates (8)
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
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <stdio.h>
#include <string.h>
#include "eppfm.h"
#include <gtk/gtk.h>

#include "callbacks.h"
#include "interface.h"
#include "support.h"

void on_button1750_pressed(GtkButton *button, gpointer user_data)
{
	audio_1750(1);
	audio_ptt(1);
}

void on_button1750_released(GtkButton *button, gpointer user_data)
{
	audio_1750(0);
	audio_ptt(0);
}

void on_buttonptt_pressed(GtkButton *button, gpointer user_data)
{
	audio_ptt(1);
}

void on_buttonptt_released(GtkButton *button, gpointer user_data)
{
	audio_ptt(0);
}

void on_buttondtmf(GtkButton *button, gpointer user_data)
{
	unsigned int data = (unsigned int)user_data;

	if (data >= 0x10)
		audio_dtmf(data & 15);
	else
		audio_dtmf(-1);
}

void on_exit_activate(GtkMenuItem *menuitem, gpointer user_data)
{
	gtk_main_quit();
}

void on_about_activate(GtkMenuItem *menuitem, gpointer user_data)
{
	printf("blah\n");
}

gboolean on_mainwindow_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
	return FALSE;
}

void on_mainwindow_destroy(GtkObject *object, gpointer user_data)
{
	gtk_main_quit();
}

gboolean on_mainwindow_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
	const char dtmfch[] = "0123456789ABCD*#";
	char *cp;
	unsigned v;

	cp = strchr(dtmfch, event->keyval);
	if (!cp)
		return FALSE;
	v = cp - dtmfch;
	if (v >= 16)
		return FALSE;
	audio_dtmf(v);
	return TRUE;
	/*printf("key_press: keyval %u length %d\n", event->keyval, event->length);*/
}

gboolean on_mainwindow_key_release_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
	const char dtmfch[] = "0123456789ABCD*#";
	char *cp;
	unsigned v;

	cp = strchr(dtmfch, event->keyval);
	if (!cp)
		return FALSE;
	v = cp - dtmfch;
	if (v >= 16)
		return FALSE;
	audio_dtmf(-1);
	return TRUE;
	/*printf("key_release: keyval %u length %d\n", event->keyval, event->length);*/
}