00001
00002
00003
00004
00005 #ifdef HAVE_CONFIG_H
00006 # include <config.h>
00007 #endif
00008
00009 #include <sys/types.h>
00010 #include <sys/stat.h>
00011 #include <unistd.h>
00012 #include <string.h>
00013 #include <stdio.h>
00014
00015 #include <bonobo.h>
00016 #include <gnome.h>
00017
00018 #include "prop_callbacks.h"
00019 #include "prop_interface.h"
00020 #include "support.h"
00021 #include "preferences.h"
00022
00023 #define GLADE_HOOKUP_OBJECT(component,widget,name) \
00024 g_object_set_data_full (G_OBJECT (component), name, \
00025 gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
00026
00027 #define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
00028 g_object_set_data (G_OBJECT (component), name, widget)
00029
00030 GtkWidget*
00031 create_morse2txt_properties (void)
00032 {
00033 GtkWidget *morse2txt_properties;
00034 GtkWidget *notebook1;
00035 GtkWidget *frame2;
00036 GtkWidget *table1;
00037 GtkWidget *label6;
00038 GtkWidget *label4;
00039 GtkWidget *label7;
00040 GtkWidget *frequency_resolution_entry;
00041 GtkWidget *label5;
00042 GtkWidget *maximum_wpm_entry;
00043 GtkWidget *comboboxentrySampleFrequency;
00044 GtkWidget *comboboxentryFFTPacketLength;
00045 GtkWidget *label3;
00046 GtkWidget *label1;
00047 GtkWidget *frame1;
00048 GtkWidget *vbox1;
00049 GtkWidget *label13;
00050 GtkWidget *comboboxentryDeviceType;
00051 GtkWidget *label9;
00052 GtkWidget *comboboxentryDevicePath;
00053 GtkWidget *label8;
00054 GtkWidget *label2;
00055 GtkWidget *frame3;
00056 GtkWidget *alignment1;
00057 GtkWidget *vbox2;
00058 GtkWidget *label12;
00059 GtkWidget *comboboxentryFilterTaps;
00060 GtkWidget *label11;
00061 GtkWidget *label10;
00062
00063 morse2txt_properties = gnome_property_box_new ();
00064 gtk_window_set_title (GTK_WINDOW (morse2txt_properties), _("Properties"));
00065 gtk_window_set_modal (GTK_WINDOW (morse2txt_properties), TRUE);
00066 gtk_window_set_resizable (GTK_WINDOW (morse2txt_properties), FALSE);
00067
00068 notebook1 = GNOME_PROPERTY_BOX (morse2txt_properties)->notebook;
00069 gtk_widget_show (notebook1);
00070 gtk_container_set_border_width (GTK_CONTAINER (notebook1), 10);
00071
00072 frame2 = gtk_frame_new (NULL);
00073 gtk_widget_show (frame2);
00074 gtk_container_add (GTK_CONTAINER (notebook1), frame2);
00075 gtk_container_set_border_width (GTK_CONTAINER (frame2), 5);
00076
00077 table1 = gtk_table_new (4, 2, FALSE);
00078 gtk_widget_show (table1);
00079 gtk_container_add (GTK_CONTAINER (frame2), table1);
00080 gtk_container_set_border_width (GTK_CONTAINER (table1), 10);
00081 gtk_table_set_row_spacings (GTK_TABLE (table1), 5);
00082 gtk_table_set_col_spacings (GTK_TABLE (table1), 10);
00083
00084 label6 = gtk_label_new (_("Sample Frequency"));
00085 gtk_widget_show (label6);
00086 gtk_table_attach (GTK_TABLE (table1), label6, 1, 2, 0, 1,
00087 (GtkAttachOptions) (GTK_FILL),
00088 (GtkAttachOptions) (0), 0, 0);
00089 gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_CENTER);
00090 gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);
00091
00092 label4 = gtk_label_new (_("FFT Packet Length"));
00093 gtk_widget_show (label4);
00094 gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 0, 1,
00095 (GtkAttachOptions) (GTK_FILL),
00096 (GtkAttachOptions) (0), 0, 0);
00097 gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_CENTER);
00098 gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
00099
00100 label7 = gtk_label_new (_("Frequency Resolution (Hz)"));
00101 gtk_widget_show (label7);
00102 gtk_table_attach (GTK_TABLE (table1), label7, 1, 2, 2, 3,
00103 (GtkAttachOptions) (GTK_FILL),
00104 (GtkAttachOptions) (0), 0, 0);
00105 gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_CENTER);
00106 gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);
00107
00108 frequency_resolution_entry = gtk_entry_new ();
00109 gtk_widget_show (frequency_resolution_entry);
00110 gtk_table_attach (GTK_TABLE (table1), frequency_resolution_entry, 1, 2, 3, 4,
00111 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
00112 (GtkAttachOptions) (0), 0, 0);
00113 gtk_editable_set_editable (GTK_EDITABLE (frequency_resolution_entry), FALSE);
00114
00115 label5 = gtk_label_new (_("Maximum WPM"));
00116 gtk_widget_show (label5);
00117 gtk_table_attach (GTK_TABLE (table1), label5, 0, 1, 2, 3,
00118 (GtkAttachOptions) (GTK_FILL),
00119 (GtkAttachOptions) (0), 0, 0);
00120 gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_CENTER);
00121 gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5);
00122
00123 maximum_wpm_entry = gtk_entry_new ();
00124 gtk_widget_show (maximum_wpm_entry);
00125 gtk_table_attach (GTK_TABLE (table1), maximum_wpm_entry, 0, 1, 3, 4,
00126 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
00127 (GtkAttachOptions) (0), 0, 0);
00128 gtk_editable_set_editable (GTK_EDITABLE (maximum_wpm_entry), FALSE);
00129 gtk_entry_set_text (GTK_ENTRY (maximum_wpm_entry), _("20"));
00130
00131 comboboxentrySampleFrequency = gtk_combo_box_entry_new_text ();
00132 gtk_widget_show (comboboxentrySampleFrequency);
00133 gtk_table_attach (GTK_TABLE (table1), comboboxentrySampleFrequency, 1, 2, 1, 2,
00134 (GtkAttachOptions) (GTK_FILL),
00135 (GtkAttachOptions) (GTK_FILL), 0, 0);
00136 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentrySampleFrequency), _("4000"));
00137 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentrySampleFrequency), _("8000"));
00138 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentrySampleFrequency), _("11025"));
00139 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentrySampleFrequency), _("16000"));
00140 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentrySampleFrequency), _("22050"));
00141 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentrySampleFrequency), _("44100"));
00142
00143 comboboxentryFFTPacketLength = gtk_combo_box_entry_new_text ();
00144 gtk_widget_show (comboboxentryFFTPacketLength);
00145 gtk_table_attach (GTK_TABLE (table1), comboboxentryFFTPacketLength, 0, 1, 1, 2,
00146 (GtkAttachOptions) (GTK_FILL),
00147 (GtkAttachOptions) (GTK_FILL), 0, 0);
00148 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentryFFTPacketLength), _("16"));
00149 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentryFFTPacketLength), _("32"));
00150 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentryFFTPacketLength), _("64"));
00151 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentryFFTPacketLength), _("128"));
00152 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentryFFTPacketLength), _("256"));
00153
00154 label3 = gtk_label_new (_("Morse Settings"));
00155 gtk_widget_show (label3);
00156 gtk_frame_set_label_widget (GTK_FRAME (frame2), label3);
00157
00158 label1 = gtk_label_new (_("Morse"));
00159 gtk_widget_show (label1);
00160 gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label1);
00161 gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_CENTER);
00162
00163 frame1 = gtk_frame_new (NULL);
00164 gtk_widget_show (frame1);
00165 gtk_container_add (GTK_CONTAINER (notebook1), frame1);
00166 gtk_container_set_border_width (GTK_CONTAINER (frame1), 5);
00167
00168 vbox1 = gtk_vbox_new (FALSE, 0);
00169 gtk_widget_show (vbox1);
00170 gtk_container_add (GTK_CONTAINER (frame1), vbox1);
00171 gtk_container_set_border_width (GTK_CONTAINER (vbox1), 10);
00172 label13 = gtk_label_new (_("Device Type"));
00173
00174 gtk_box_pack_start (GTK_BOX (vbox1), label13, FALSE, FALSE, 0);
00175
00176 comboboxentryDeviceType = gtk_combo_box_entry_new_text ();
00177
00178 gtk_box_pack_start (GTK_BOX (vbox1), comboboxentryDeviceType, FALSE, FALSE, 0);
00179
00180 label9 = gtk_label_new (_("Device Path"));
00181 gtk_widget_show (label9);
00182 gtk_box_pack_start (GTK_BOX (vbox1), label9, FALSE, FALSE, 0);
00183 gtk_label_set_justify (GTK_LABEL (label9), GTK_JUSTIFY_CENTER);
00184
00185 comboboxentryDevicePath = gtk_combo_box_entry_new_text ();
00186 gtk_widget_show (comboboxentryDevicePath);
00187 gtk_box_pack_start (GTK_BOX (vbox1), comboboxentryDevicePath, FALSE, FALSE, 0);
00188 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentryDevicePath), _("/dev/dsp"));
00189 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentryDevicePath), _("/dev/audio"));
00190
00191 label8 = gtk_label_new (_("Audio Device Settings"));
00192 gtk_widget_show (label8);
00193 gtk_frame_set_label_widget (GTK_FRAME (frame1), label8);
00194
00195 label2 = gtk_label_new (_("Sound"));
00196 gtk_widget_show (label2);
00197 gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label2);
00198 gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_CENTER);
00199
00200 frame3 = gtk_frame_new (NULL);
00201 gtk_widget_show (frame3);
00202 gtk_container_add (GTK_CONTAINER (notebook1), frame3);
00203 gtk_container_set_border_width (GTK_CONTAINER (frame3), 5);
00204
00205 alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
00206 gtk_widget_show (alignment1);
00207 gtk_container_add (GTK_CONTAINER (frame3), alignment1);
00208 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0);
00209
00210 vbox2 = gtk_vbox_new (FALSE, 0);
00211 gtk_widget_show (vbox2);
00212 gtk_container_add (GTK_CONTAINER (alignment1), vbox2);
00213 gtk_container_set_border_width (GTK_CONTAINER (vbox2), 10);
00214
00215 label12 = gtk_label_new (_("Taps"));
00216 gtk_widget_show (label12);
00217 gtk_box_pack_start (GTK_BOX (vbox2), label12, FALSE, FALSE, 0);
00218 gtk_label_set_justify (GTK_LABEL (label12), GTK_JUSTIFY_CENTER);
00219
00220 comboboxentryFilterTaps = gtk_combo_box_entry_new_text ();
00221 gtk_widget_show (comboboxentryFilterTaps);
00222 gtk_box_pack_start (GTK_BOX (vbox2), comboboxentryFilterTaps, FALSE, FALSE, 0);
00223 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentryFilterTaps), _("8"));
00224 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentryFilterTaps), _("16"));
00225 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentryFilterTaps), _("32"));
00226 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentryFilterTaps), _("64"));
00227 gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentryFilterTaps), _("128"));
00228
00229 label11 = gtk_label_new (_("Filter Settings"));
00230 gtk_widget_show (label11);
00231 gtk_frame_set_label_widget (GTK_FRAME (frame3), label11);
00232 gtk_label_set_use_markup (GTK_LABEL (label11), TRUE);
00233
00234 label10 = gtk_label_new (_("Filter"));
00235 gtk_widget_show (label10);
00236 gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), label10);
00237
00238 g_signal_connect ((gpointer) morse2txt_properties, "apply",
00239 G_CALLBACK (on_morse2txt_properties_apply),
00240 NULL);
00241 g_signal_connect ((gpointer) morse2txt_properties, "show",
00242 G_CALLBACK (on_morse2txt_properties_show),
00243 NULL);
00244 g_signal_connect ((gpointer) comboboxentrySampleFrequency, "changed",
00245 G_CALLBACK (widget_in_property_box_changed),
00246 NULL);
00247 g_signal_connect ((gpointer) comboboxentryFFTPacketLength, "changed",
00248 G_CALLBACK (widget_in_property_box_changed),
00249 NULL);
00250 g_signal_connect ((gpointer) comboboxentryDeviceType, "changed",
00251 G_CALLBACK (widget_in_property_box_changed),
00252 NULL);
00253 g_signal_connect ((gpointer) comboboxentryDevicePath, "changed",
00254 G_CALLBACK (widget_in_property_box_changed),
00255 NULL);
00256 g_signal_connect ((gpointer) comboboxentryFilterTaps, "changed",
00257 G_CALLBACK (widget_in_property_box_changed),
00258 NULL);
00259
00260
00261 GLADE_HOOKUP_OBJECT_NO_REF (morse2txt_properties, morse2txt_properties, "morse2txt_properties");
00262 GLADE_HOOKUP_OBJECT_NO_REF (morse2txt_properties, notebook1, "notebook1");
00263 GLADE_HOOKUP_OBJECT (morse2txt_properties, frame2, "frame2");
00264 GLADE_HOOKUP_OBJECT (morse2txt_properties, table1, "table1");
00265 GLADE_HOOKUP_OBJECT (morse2txt_properties, label6, "label6");
00266 GLADE_HOOKUP_OBJECT (morse2txt_properties, label4, "label4");
00267 GLADE_HOOKUP_OBJECT (morse2txt_properties, label7, "label7");
00268 GLADE_HOOKUP_OBJECT (morse2txt_properties, frequency_resolution_entry, "frequency_resolution_entry");
00269 GLADE_HOOKUP_OBJECT (morse2txt_properties, label5, "label5");
00270 GLADE_HOOKUP_OBJECT (morse2txt_properties, maximum_wpm_entry, "maximum_wpm_entry");
00271 GLADE_HOOKUP_OBJECT (morse2txt_properties, comboboxentrySampleFrequency, "comboboxentrySampleFrequency");
00272 GLADE_HOOKUP_OBJECT (morse2txt_properties, comboboxentryFFTPacketLength, "comboboxentryFFTPacketLength");
00273 GLADE_HOOKUP_OBJECT (morse2txt_properties, label3, "label3");
00274 GLADE_HOOKUP_OBJECT (morse2txt_properties, label1, "label1");
00275 GLADE_HOOKUP_OBJECT (morse2txt_properties, frame1, "frame1");
00276 GLADE_HOOKUP_OBJECT (morse2txt_properties, vbox1, "vbox1");
00277 GLADE_HOOKUP_OBJECT (morse2txt_properties, label13, "label13");
00278 GLADE_HOOKUP_OBJECT (morse2txt_properties, comboboxentryDeviceType, "comboboxentryDeviceType");
00279 GLADE_HOOKUP_OBJECT (morse2txt_properties, label9, "label9");
00280 GLADE_HOOKUP_OBJECT (morse2txt_properties, comboboxentryDevicePath, "comboboxentryDevicePath");
00281 GLADE_HOOKUP_OBJECT (morse2txt_properties, label8, "label8");
00282 GLADE_HOOKUP_OBJECT (morse2txt_properties, label2, "label2");
00283 GLADE_HOOKUP_OBJECT (morse2txt_properties, frame3, "frame3");
00284 GLADE_HOOKUP_OBJECT (morse2txt_properties, alignment1, "alignment1");
00285 GLADE_HOOKUP_OBJECT (morse2txt_properties, vbox2, "vbox2");
00286 GLADE_HOOKUP_OBJECT (morse2txt_properties, label12, "label12");
00287 GLADE_HOOKUP_OBJECT (morse2txt_properties, comboboxentryFilterTaps, "comboboxentryFilterTaps");
00288 GLADE_HOOKUP_OBJECT (morse2txt_properties, label11, "label11");
00289 GLADE_HOOKUP_OBJECT (morse2txt_properties, label10, "label10");
00290
00291
00295 gtk_entry_set_editable(GTK_ENTRY(GTK_BIN(comboboxentryFFTPacketLength)->child), FALSE);
00296 gtk_entry_set_editable(GTK_ENTRY(GTK_BIN(comboboxentrySampleFrequency)->child), FALSE);
00297 gtk_entry_set_editable(GTK_ENTRY(GTK_BIN(comboboxentryDeviceType)->child), FALSE);
00298 gtk_entry_set_editable(GTK_ENTRY(GTK_BIN(comboboxentryDevicePath)->child), FALSE);
00299 gtk_entry_set_editable(GTK_ENTRY(GTK_BIN(comboboxentryFilterTaps)->child), FALSE);
00300
00301 return morse2txt_properties;
00302 }
00303