#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <gdk/gdkkeysyms.h>
#include <gnome.h>
#include <malloc.h>
#include <stdlib.h>
#include <gdk/gdk.h>
#include <glib.h>
#include "morse.h"
#include "audio.h"
#include "interface_il.h"
#include "support.h"
Go to the source code of this file.
Defines | |
#define | STATUS_BAR_MESSAGE_LENGTH 25 |
#define | NUMBER_OF_STATUS_BARS 03 |
#define | MAX_SPACES_TO_APPEND 30 |
#define | NUM_PLOTS 3 |
#define | BW_WIDGET_NAME_PREFIX "bw" |
#define | BW_WIDGET_NAME_SUFFIX "_hz" |
#define | BW_WIDGET_NAME_LENGTH 16 |
#define | open_plot_debug_pipe(void) |
Functions | |
G_LOCK_DEFINE (y) | |
G_LOCK_DEFINE (buffer) | |
static void | update_status_bar (uint32_t ffts, uint32_t samples, double wpm) |
Thread safe method that updates the status bar. | |
static void | update_statistics_window (const morse_stats_ts *stats_t) |
static void | gui_append_character_2_morse_text (char *character) |
Thread safe method that appends text to the decoded text widget. | |
static void | scope_fft_plot (double *vector, uint32_t num_points) |
Thread safe method that displays waveform on scope_v widget. | |
static void | dialog_box (char *message) |
Wrapper function for whatever GUI message box is implemented. | |
int32_t | plot_fft_data_array_create (uint32_t num_points) |
Method that allocates the waveform data to be displayed by the scope_v widget. | |
void | plot_fft_data_array_destroy (void) |
De-allocates array created by plot_fft_data_array_create. | |
void | statistics_window_deleted_handler (void) |
void | init_gui_interface_hooks (void) |
Registers GUI handlers into Morse GUI Handler Interface. | |
uint32_t | get_fft_data_size (void) |
int32_t | get_fft_graph_top (void) |
uint32_t | get_tone_packet_size (void) |
int32_t | threads_stop (void) |
This function is put into the GUI main loop to cancel running threads. | |
void | preferences_enabled (gboolean state) |
Used to enable/disable access to the preferences when the morse code threads are stopped/running. | |
void | interface_activate_bw_chk_item (const int32_t bw) |
Variables | |
static char | name_buffer [BW_WIDGET_NAME_LENGTH] |
GtkWidget * | morse_stats = NULL |
static gfloat * | y = NULL |
static char | buffer [NUMBER_OF_STATUS_BARS][STATUS_BAR_MESSAGE_LENGTH] |
#define BW_WIDGET_NAME_LENGTH 16 |
Max size of temporay text buffer.
Definition at line 63 of file interface_il.c.
Referenced by interface_activate_bw_chk_item(), and update_statistics_window().
#define BW_WIDGET_NAME_PREFIX "bw" |
Prefix for bandwidth radio items in main GUI.
Definition at line 56 of file interface_il.c.
Referenced by interface_activate_bw_chk_item().
#define BW_WIDGET_NAME_SUFFIX "_hz" |
Suffix for bandwidth radio items in main GUI.
Definition at line 58 of file interface_il.c.
Referenced by interface_activate_bw_chk_item().
#define MAX_SPACES_TO_APPEND 30 |
Definition at line 50 of file interface_il.c.
#define NUM_PLOTS 3 |
Maximum number of plots for debug plotting.
Definition at line 53 of file interface_il.c.
#define NUMBER_OF_STATUS_BARS 03 |
Definition at line 49 of file interface_il.c.
#define open_plot_debug_pipe | ( | void | ) |
#define STATUS_BAR_MESSAGE_LENGTH 25 |
Definition at line 48 of file interface_il.c.
static void dialog_box | ( | char * | message | ) | [static] |
Wrapper function for whatever GUI message box is implemented.
Definition at line 222 of file interface_il.c.
References main_gui, and main_widgets::main_window_v.
Referenced by init_gui_interface_hooks().
G_LOCK_DEFINE | ( | buffer | ) |
G_LOCK_DEFINE | ( | y | ) |
uint32_t get_fft_data_size | ( | void | ) |
Definition at line 242 of file interface_il.c.
References morse_get_fft_data_size().
Referenced by create_MainWindow().
int32_t get_fft_graph_top | ( | void | ) |
Definition at line 243 of file interface_il.c.
References morse_get_fft_graph_top().
Referenced by create_MainWindow().
uint32_t get_tone_packet_size | ( | void | ) |
Definition at line 244 of file interface_il.c.
References morse_get_tone_packet_size().
Referenced by on_startbutton_clicked().
static void gui_append_character_2_morse_text | ( | char * | character | ) | [static] |
Thread safe method that appends text to the decoded text widget.
character | pointer to one or more ascii characters |
Definition at line 99 of file interface_il.c.
References main_widgets::decoded_text_v, FALSE, and main_gui.
Referenced by init_gui_interface_hooks().
void init_gui_interface_hooks | ( | void | ) |
Registers GUI handlers into Morse GUI Handler Interface.
Definition at line 231 of file interface_il.c.
References dialog_box(), gui_append_character_2_morse_text(), open_plot_debug_pipe, register_debug_plot, register_error_message_handler(), scope_fft_plot(), set_display_character_hndlr(), set_Morse_statistics_display_hndlr(), set_scope_plot_hndlr(), set_update_status_hndlr(), update_statistics_window(), and update_status_bar().
Referenced by main().
void interface_activate_bw_chk_item | ( | const int32_t | bw | ) |
Used to activate the appropriate bandwidth radio box when the application is started.
bw | Bandwidth in Hertz. |
Definition at line 261 of file interface_il.c.
References BW_WIDGET_NAME_LENGTH, BW_WIDGET_NAME_PREFIX, BW_WIDGET_NAME_SUFFIX, lookup_widget(), main_gui, main_widgets::main_window_v, name_buffer, and TRUE.
Referenced by main().
int32_t plot_fft_data_array_create | ( | uint32_t | num_points | ) |
Method that allocates the waveform data to be displayed by the scope_v widget.
num_points | size of array to create |
Definition at line 117 of file interface_il.c.
References main_gui, main_widgets::scope_v, and y.
Referenced by on_startbutton_clicked().
void plot_fft_data_array_destroy | ( | void | ) |
De-allocates array created by plot_fft_data_array_create.
Definition at line 128 of file interface_il.c.
References y.
Referenced by threads_stop().
void preferences_enabled | ( | gboolean | state | ) |
Used to enable/disable access to the preferences when the morse code threads are stopped/running.
Definition at line 254 of file interface_il.c.
References lookup_widget(), main_gui, and main_widgets::main_window_v.
Referenced by on_startbutton_clicked(), and threads_stop().
static void scope_fft_plot | ( | double * | vector, | |
uint32_t | num_points | |||
) | [static] |
Thread safe method that displays waveform on scope_v widget.
vector | pointer to array of waveform to be plotted | |
num_points | size of array |
Definition at line 150 of file interface_il.c.
References main_gui, main_widgets::scope_v, and y.
Referenced by init_gui_interface_hooks().
void statistics_window_deleted_handler | ( | void | ) |
This is called when the Statistics window is destroyed.
Definition at line 136 of file interface_il.c.
References FALSE, lookup_widget(), main_gui, main_widgets::main_window_v, and morse_stats.
Referenced by on_stats_window_delete_event().
int32_t threads_stop | ( | void | ) |
This function is put into the GUI main loop to cancel running threads.
Definition at line 246 of file interface_il.c.
References morse_stop_threads(), plot_fft_data_array_destroy(), preferences_enabled(), and TRUE.
Referenced by on_exit1_activate(), on_exit_button_clicked(), on_MainWindow_delete_event(), and on_stop_button_clicked().
static void update_statistics_window | ( | const morse_stats_ts * | stats_t | ) | [static] |
Thread safe method that updates the status bar.
stats_t | Various Morse Statistics |
Definition at line 192 of file interface_il.c.
References morse_stats_ts::avg_dah_dur, morse_stats_ts::avg_dit_dur, BW_WIDGET_NAME_LENGTH, morse_stats_ts::dah_dit_ratio, lookup_widget(), morse_stats, name_buffer, and morse_stats_ts::wpm.
Referenced by init_gui_interface_hooks().
static void update_status_bar | ( | uint32_t | ffts, | |
uint32_t | samples, | |||
double | wpm | |||
) | [static] |
Thread safe method that updates the status bar.
ffts | number of fft packets processed | |
samples | number of audio samples processed | |
wpm | code speed in Words per Minute |
Definition at line 172 of file interface_il.c.
References buffer, main_widgets::ffts_statusbar_v, main_gui, main_widgets::samples_statusbar_v, STATUS_BAR_MESSAGE_LENGTH, and main_widgets::wpm_statusbar_v.
Referenced by init_gui_interface_hooks().
char buffer[NUMBER_OF_STATUS_BARS][STATUS_BAR_MESSAGE_LENGTH] [static] |
GtkWidget* morse_stats = NULL |
Morse statistics display.
Definition at line 68 of file interface_il.c.
Referenced by on_statistics_activate(), statistics_window_deleted_handler(), and update_statistics_window().
char name_buffer[BW_WIDGET_NAME_LENGTH] [static] |
Temporary buffer for text manipulations.
Definition at line 65 of file interface_il.c.
Referenced by interface_activate_bw_chk_item(), and update_statistics_window().
gfloat* y = NULL [static] |
Temporary array for GtkCurve data.
Definition at line 71 of file interface_il.c.
Referenced by plot_fft_data_array_create(), plot_fft_data_array_destroy(), and scope_fft_plot().