83 |
{ |
{ |
84 |
if (saving != 1 && preferences.saving == 1) |
if (saving != 1 && preferences.saving == 1) |
85 |
{ |
{ |
86 |
gdk_input_remove (savetimer); |
g_source_remove (savetimer); |
87 |
savetimer = -1; |
savetimer = -1; |
88 |
} |
} |
89 |
else if (saving == 1 && preferences.saving != 1) |
else if (saving == 1 && preferences.saving != 1) |
93 |
} |
} |
94 |
else if (value != preferences.autosave) |
else if (value != preferences.autosave) |
95 |
{ /* new value, stop and start timer */ |
{ /* new value, stop and start timer */ |
96 |
gdk_input_remove (savetimer); |
g_source_remove (savetimer); |
97 |
savetimer = |
savetimer = |
98 |
gtk_timeout_add (value * 60 * 1000, (GtkFunction) autosave, NULL); |
gtk_timeout_add (value * 60 * 1000, (GtkFunction) autosave, NULL); |
99 |
} |
} |
106 |
set_theme (gchar * color, gchar * font, gboolean alsoforlog) |
set_theme (gchar * color, gchar * font, gboolean alsoforlog) |
107 |
{ |
{ |
108 |
GtkWidget *clocklabel, *qsoframe, *dxccframe; |
GtkWidget *clocklabel, *qsoframe, *dxccframe; |
109 |
gint i, row; |
gint i; |
110 |
logtype *logwindow; |
logtype *logwindow; |
111 |
gint logcolor; |
gint logcolor; |
|
gboolean logcolordone = FALSE; |
|
|
GtkStyle *cellstyle; |
|
112 |
#if WANT_HAMLIB |
#if WANT_HAMLIB |
113 |
GtkWidget *frequencylabel; |
GtkWidget *frequencylabel, *smeterlabel; |
114 |
#endif |
#endif |
115 |
|
|
116 |
logcolor = alsoforlog ? 1 : 0; |
logcolor = alsoforlog ? 1 : 0; |
117 |
|
|
118 |
if (g_strcasecmp (color, preferences.themecolor) || |
if (g_ascii_strcasecmp (color, preferences.themecolor) || |
119 |
g_strcasecmp (font, preferences.themefont)) |
g_ascii_strcasecmp (font, preferences.themefont)) |
120 |
{ |
{ |
121 |
clocklabel = lookup_widget (mainwindow, "clocklabel"); |
clocklabel = lookup_widget (mainwindow, "clocklabel"); |
122 |
setlabelstyle (clocklabel, color, font); |
setlabelstyle (clocklabel, color, font); |
123 |
#if WANT_HAMLIB |
#if WANT_HAMLIB |
124 |
frequencylabel = lookup_widget (mainwindow, "frequencylabel"); |
frequencylabel = lookup_widget (mainwindow, "frequencylabel"); |
125 |
setlabelstyle (frequencylabel, color, font); |
setlabelstyle (frequencylabel, color, font); |
126 |
|
smeterlabel = lookup_widget (mainwindow, "smeterlabel"); |
127 |
|
setlabelstyle (smeterlabel, color, font); |
128 |
#endif |
#endif |
129 |
qsoframe = lookup_widget (mainwindow, "qsoframe"); |
qsoframe = lookup_widget (mainwindow, "qsoframe"); |
130 |
dxccframe = lookup_widget (mainwindow, "dxccframe"); |
dxccframe = lookup_widget (mainwindow, "dxccframe"); |
135 |
logwindow = g_list_nth_data (logwindowlist, i); |
logwindow = g_list_nth_data (logwindowlist, i); |
136 |
setlabelstyle (logwindow->label, color, font); |
setlabelstyle (logwindow->label, color, font); |
137 |
} |
} |
|
if (alsoforlog) /* apply to the log if needed */ |
|
|
{ |
|
|
for (i = 0; i < g_list_length (logwindowlist); i++) |
|
|
{ |
|
|
logwindow = g_list_nth_data (logwindowlist, i); |
|
|
gtk_clist_freeze (GTK_CLIST (logwindow->clist)); |
|
|
for (row = 0; row < logwindow->qsos; row++) |
|
|
setcallstyle (logwindow->clist, row, color, font); |
|
|
gtk_clist_thaw (GTK_CLIST (logwindow->clist)); |
|
|
} |
|
|
logcolordone = TRUE; |
|
|
} |
|
138 |
preferences.themecolor = color; |
preferences.themecolor = color; |
139 |
preferences.themefont = g_strdup (font); |
preferences.themefont = g_strdup (font); |
140 |
} |
} |
141 |
|
|
142 |
/* does the log need color? */ |
preferences.logcolor = logcolor; |
|
if (logcolor != preferences.logcolor) |
|
|
{ |
|
|
if ((logcolor == 1) && (!logcolordone)) |
|
|
{ |
|
|
for (i = 0; i < g_list_length (logwindowlist); i++) |
|
|
{ |
|
|
logwindow = g_list_nth_data (logwindowlist, i); |
|
|
gtk_clist_freeze (GTK_CLIST (logwindow->clist)); |
|
|
for (row = 0; row < logwindow->qsos; row++) |
|
|
setcallstyle (logwindow->clist, row, |
|
|
preferences.themecolor, preferences.themefont); |
|
|
gtk_clist_thaw (GTK_CLIST (logwindow->clist)); |
|
|
} |
|
|
} |
|
|
if (logcolor == 0) |
|
|
{ |
|
|
for (i = 0; i < g_list_length (logwindowlist); i++) |
|
|
{ |
|
|
logwindow = g_list_nth_data (logwindowlist, i); |
|
|
gtk_clist_freeze (GTK_CLIST (logwindow->clist)); |
|
|
cellstyle = |
|
|
gtk_clist_get_cell_style (GTK_CLIST (logwindow->clist), 0, 0); |
|
|
for (row = 0; row < logwindow->qsos; row++) |
|
|
gtk_clist_set_cell_style (GTK_CLIST (logwindow->clist), row, |
|
|
CALL, cellstyle); |
|
|
gtk_clist_thaw (GTK_CLIST (logwindow->clist)); |
|
|
} |
|
|
} |
|
|
preferences.logcolor = logcolor; |
|
|
} |
|
143 |
} |
} |
144 |
|
|
145 |
/* set savepath if changed */ |
/* set savepath if changed */ |
155 |
str = g_strdup (path->str); |
str = g_strdup (path->str); |
156 |
/* remove trailing slash */ |
/* remove trailing slash */ |
157 |
g_strreverse (str); |
g_strreverse (str); |
158 |
if (!g_strncasecmp (str, "/", 1)) |
if (!g_ascii_strncasecmp (str, "/", 1)) |
159 |
{ |
{ |
160 |
path = g_string_erase (path, (path->len) - 1, 1); |
path = g_string_erase (path, (path->len) - 1, 1); |
161 |
} |
} |
166 |
g_free (fpathstr); |
g_free (fpathstr); |
167 |
} |
} |
168 |
g_free (str); |
g_free (str); |
169 |
if (g_strcasecmp (preferences.savedir, path->str)) |
if (g_ascii_strcasecmp (preferences.savedir, path->str)) |
170 |
preferences.savedir = g_strdup (path->str); |
preferences.savedir = g_strdup (path->str); |
171 |
g_string_free (path, TRUE); |
g_string_free (path, TRUE); |
172 |
} |
} |
178 |
{ |
{ |
179 |
gchar **logsplit; |
gchar **logsplit; |
180 |
|
|
181 |
if (g_strcasecmp (logs, preferences.logstoload) != 0) |
if (g_ascii_strcasecmp (logs, preferences.logstoload) != 0) |
182 |
{ |
{ |
183 |
if (strlen (logs) == 0) |
if (strlen (logs) == 0) |
184 |
logs = g_strdup ("*"); |
logs = g_strdup ("*"); |
193 |
static void |
static void |
194 |
set_qthlocator (gchar * locator) |
set_qthlocator (gchar * locator) |
195 |
{ |
{ |
196 |
if (g_strcasecmp (locator, preferences.locator) != 0) |
if (g_ascii_strcasecmp (locator, preferences.locator) != 0) |
197 |
{ |
{ |
198 |
if (strlen (locator) == 0) |
if (strlen (locator) == 0) |
199 |
locator = g_strdup ("AA00AA"); |
locator = g_strdup ("AA00AA"); |
205 |
static void |
static void |
206 |
set_callsign (gchar * callsign) |
set_callsign (gchar * callsign) |
207 |
{ |
{ |
208 |
if (g_strcasecmp (callsign, preferences.callsign) != 0) |
if (g_ascii_strcasecmp (callsign, preferences.callsign) != 0) |
209 |
{ |
{ |
210 |
if (strlen (callsign) == 0) |
if (strlen (callsign) == 0) |
211 |
callsign = g_strdup ("N0CALL"); |
callsign = g_strdup ("N0CALL"); |
236 |
else |
else |
237 |
{ /* no clock */ |
{ /* no clock */ |
238 |
if (preferences.clock > 0) |
if (preferences.clock > 0) |
239 |
gdk_input_remove (clocktimer); |
g_source_remove (clocktimer); |
240 |
clocktimer = -1; |
clocktimer = -1; |
241 |
gtk_widget_hide (clocklabel); |
gtk_widget_hide (clocklabel); |
242 |
gtk_widget_hide (clockpixmap); |
gtk_widget_hide (clockpixmap); |
262 |
gint bandindex = 0, modeindex = 0, autosavevalue, saving; |
gint bandindex = 0, modeindex = 0, autosavevalue, saving; |
263 |
#if WANT_HAMLIB |
#if WANT_HAMLIB |
264 |
GtkWidget *hamlibcheckbutton, *radiocomboentry, *devicecomboentry, |
GtkWidget *hamlibcheckbutton, *radiocomboentry, *devicecomboentry, |
265 |
*frequencycheckbutton, *digitscomboentry, *smetercheckbutton, |
*frequencycheckbutton, *digitscomboentry, *smetercheckbutton; |
|
*drawingarea; |
|
266 |
gchar *radio = NULL, *device = NULL, *digits = NULL; |
gchar *radio = NULL, *device = NULL, *digits = NULL; |
267 |
gboolean hamlibyes, frequencyyesno, smeteryesno; |
gboolean hamlibyes, frequencyyesno, smeteryesno; |
268 |
gint rigid, retcode; |
gint rigid, retcode; |
351 |
else |
else |
352 |
preferences.longitude = atof (temp); |
preferences.longitude = atof (temp); |
353 |
temp = gtk_editable_get_chars (GTK_EDITABLE (NScomboentry), 0, 1); |
temp = gtk_editable_get_chars (GTK_EDITABLE (NScomboentry), 0, 1); |
354 |
if (g_strncasecmp (temp, _("N"), 1) == 0) |
if (g_ascii_strncasecmp (temp, _("N"), 1) == 0) |
355 |
preferences.NS = 1; |
preferences.NS = 1; |
356 |
else |
else |
357 |
preferences.NS = 2; |
preferences.NS = 2; |
358 |
temp = gtk_editable_get_chars (GTK_EDITABLE (EWcomboentry), 0, 1); |
temp = gtk_editable_get_chars (GTK_EDITABLE (EWcomboentry), 0, 1); |
359 |
if (g_strncasecmp (temp, _("E"), 1) == 0) |
if (g_ascii_strncasecmp (temp, _("E"), 1) == 0) |
360 |
preferences.EW = 1; |
preferences.EW = 1; |
361 |
else |
else |
362 |
preferences.EW = 2; |
preferences.EW = 2; |
363 |
temp = gtk_editable_get_chars (GTK_EDITABLE (unitscomboentry), 0, -1); |
temp = gtk_editable_get_chars (GTK_EDITABLE (unitscomboentry), 0, -1); |
364 |
if (g_strncasecmp (temp, "K", 1) == 0) |
if (g_ascii_strncasecmp (temp, "K", 1) == 0) |
365 |
preferences.units = 1; |
preferences.units = 1; |
366 |
else |
else |
367 |
preferences.units = 0; |
preferences.units = 0; |
382 |
{ |
{ |
383 |
for (;;) |
for (;;) |
384 |
{ |
{ |
385 |
if (g_strcasecmp (temp, modesplit[modeindex]) == 0) |
if (g_ascii_strcasecmp (temp, modesplit[modeindex]) == 0) |
386 |
{ |
{ |
387 |
gtk_option_menu_set_history (GTK_OPTION_MENU (modeoptionmenu), |
gtk_option_menu_set_history (GTK_OPTION_MENU (modeoptionmenu), |
388 |
modeindex); |
modeindex); |
413 |
{ /* only support HF bands for now */ |
{ /* only support HF bands for now */ |
414 |
for (;;) |
for (;;) |
415 |
{ |
{ |
416 |
if (g_strcasecmp (bandcopy, bandsplit[bandindex]) == 0) |
if (g_ascii_strcasecmp (bandcopy, bandsplit[bandindex]) == 0) |
417 |
{ |
{ |
418 |
gtk_option_menu_set_history (GTK_OPTION_MENU |
gtk_option_menu_set_history (GTK_OPTION_MENU |
419 |
(bandoptionmenu), bandindex); |
(bandoptionmenu), bandindex); |
499 |
else |
else |
500 |
{ |
{ |
501 |
hamlibtimer = |
hamlibtimer = |
502 |
gtk_timeout_add (200, (GtkFunction) get_riginfo, NULL); |
gtk_timeout_add (350, (GtkFunction) get_riginfo, NULL); |
503 |
} |
} |
504 |
preferences.radio = g_strdup (radio); |
preferences.radio = g_strdup (radio); |
505 |
preferences.device = g_strdup (device); |
preferences.device = g_strdup (device); |
514 |
else if ((preferences.hamlib > 0) && hamlibyes) |
else if ((preferences.hamlib > 0) && hamlibyes) |
515 |
{ |
{ |
516 |
/* see if we have selected another radio or port */ |
/* see if we have selected another radio or port */ |
517 |
if ((g_strcasecmp (radio, preferences.radio) != 0) |
if ((g_ascii_strcasecmp (radio, preferences.radio) != 0) |
518 |
|| (g_strcasecmp (device, preferences.device) != 0)) |
|| (g_ascii_strcasecmp (device, preferences.device) != 0)) |
519 |
{ |
{ |
520 |
gdk_input_remove (hamlibtimer); |
g_source_remove (hamlibtimer); |
521 |
rig_close ((RIG *) myrig); |
rig_close ((RIG *) myrig); |
522 |
rig_cleanup ((RIG *) myrig); |
rig_cleanup ((RIG *) myrig); |
523 |
rigid = get_rigid (radio); |
rigid = get_rigid (radio); |
535 |
else |
else |
536 |
{ |
{ |
537 |
hamlibtimer = |
hamlibtimer = |
538 |
gtk_timeout_add (200, (GtkFunction) get_riginfo, NULL); |
gtk_timeout_add (350, (GtkFunction) get_riginfo, NULL); |
539 |
} |
} |
540 |
} |
} |
541 |
preferences.radio = g_strdup (radio); |
preferences.radio = g_strdup (radio); |
547 |
{ |
{ |
548 |
/* hamlib disabled, close rig */ |
/* hamlib disabled, close rig */ |
549 |
hamlibwidgets = 0; |
hamlibwidgets = 0; |
550 |
gdk_input_remove (hamlibtimer); |
g_source_remove (hamlibtimer); |
551 |
hamlibtimer = -1; |
hamlibtimer = -1; |
552 |
rig_close ((RIG *) myrig); |
rig_close ((RIG *) myrig); |
553 |
rig_cleanup ((RIG *) myrig); |
rig_cleanup ((RIG *) myrig); |
566 |
if (hamlibwidgets != preferences.hamlib) |
if (hamlibwidgets != preferences.hamlib) |
567 |
{ |
{ |
568 |
sethamlibwidgets (hamlibwidgets); |
sethamlibwidgets (hamlibwidgets); |
|
/* pixmaps need to be loaded if s-meter is enabled and was disabled before */ |
|
|
if (((hamlibwidgets == 3) || (hamlibwidgets == 4)) |
|
|
&& ((preferences.hamlib == 0) || (preferences.hamlib == 1) |
|
|
|| (preferences.hamlib == 2))) |
|
|
{ |
|
|
drawingarea = lookup_widget (mainwindow, "smeterdrawingarea"); |
|
|
loadsmeter (drawingarea); |
|
|
} |
|
569 |
preferences.hamlib = hamlibwidgets; |
preferences.hamlib = hamlibwidgets; |
570 |
} |
} |
571 |
g_free (radio); |
g_free (radio); |
667 |
on_themebutton_clicked (GtkButton * button, gpointer user_data) |
on_themebutton_clicked (GtkButton * button, gpointer user_data) |
668 |
{ |
{ |
669 |
GtkWidget *colorselectiondialog; |
GtkWidget *colorselectiondialog; |
|
gdouble rgb[3]; |
|
|
gchar *themecolor; |
|
670 |
GdkColor color; |
GdkColor color; |
671 |
|
|
672 |
colorselectiondialog = create_colorselectiondialog (); |
colorselectiondialog = create_colorselectiondialog (); |
673 |
gtk_widget_destroy (GTK_COLOR_SELECTION_DIALOG (colorselectiondialog)-> |
gtk_widget_destroy (GTK_COLOR_SELECTION_DIALOG (colorselectiondialog)-> |
674 |
help_button); |
help_button); |
675 |
|
|
676 |
themecolor = color_parse (preferences.themecolor); |
gdk_color_parse (preferences.themecolor, &color); |
677 |
gdk_color_parse (themecolor, &color); |
gtk_color_selection_set_current_color (GTK_COLOR_SELECTION |
678 |
g_free (themecolor); |
(GTK_COLOR_SELECTION_DIALOG(colorselectiondialog)->colorsel), &color); |
|
rgb[0] = color.red / 65535.0; |
|
|
rgb[1] = color.green / 65535.0; |
|
|
rgb[2] = color.blue / 65535.0; |
|
|
gtk_color_selection_set_color (GTK_COLOR_SELECTION |
|
|
(GTK_COLOR_SELECTION_DIALOG |
|
|
(colorselectiondialog)->colorsel), rgb); |
|
679 |
|
|
680 |
gtk_widget_set_sensitive (preferencesdialog, 0); |
gtk_widget_set_sensitive (preferencesdialog, 0); |
681 |
gtk_widget_show (colorselectiondialog); |
gtk_widget_show (colorselectiondialog); |
707 |
GtkWidget *pathselection; |
GtkWidget *pathselection; |
708 |
|
|
709 |
pathselection = create_pathselection (); |
pathselection = create_pathselection (); |
710 |
gtk_entry_set_editable (GTK_ENTRY |
gtk_editable_set_editable (GTK_EDITABLE |
711 |
(GTK_FILE_SELECTION (pathselection)-> |
(GTK_FILE_SELECTION (pathselection)-> |
712 |
selection_entry), FALSE); |
selection_entry), FALSE); |
713 |
gtk_widget_set_sensitive (preferencesdialog, 0); |
gtk_widget_set_sensitive (preferencesdialog, 0); |
752 |
on_colorokbutton_clicked (GtkButton * button, gpointer user_data) |
on_colorokbutton_clicked (GtkButton * button, gpointer user_data) |
753 |
{ |
{ |
754 |
GtkWidget *colorselectiondialog, *examplelabel, *exampleframe; |
GtkWidget *colorselectiondialog, *examplelabel, *exampleframe; |
755 |
gdouble rgb[3]; |
GdkColor newcolor; |
756 |
gchar *colorred, *colorgreen, *colorblue, *color; |
gchar *col; |
757 |
|
|
758 |
colorselectiondialog = gtk_widget_get_toplevel (GTK_WIDGET (button)); |
colorselectiondialog = gtk_widget_get_toplevel (GTK_WIDGET (button)); |
759 |
gtk_color_selection_get_color (GTK_COLOR_SELECTION |
gtk_color_selection_get_current_color (GTK_COLOR_SELECTION |
760 |
(GTK_COLOR_SELECTION_DIALOG |
(GTK_COLOR_SELECTION_DIALOG (colorselectiondialog)->colorsel), &newcolor); |
761 |
(colorselectiondialog)->colorsel), rgb); |
|
762 |
colorred = g_strdup_printf ("%04X", (gint) (rgb[0] * 65535)); |
col = g_strdup_printf("#%02X%02X%02X", |
763 |
colorgreen = g_strdup_printf ("%04X", (gint) (rgb[1] * 65535)); |
newcolor.red >> 8, newcolor.green >> 8, newcolor.blue >> 8); |
764 |
colorblue = g_strdup_printf ("%04X", (gint) (rgb[2] * 65535)); |
|
|
color = g_strconcat (colorred, ",", colorgreen, ",", colorblue, NULL); |
|
765 |
exampleframe = lookup_widget (preferencesdialog, "exampleframe"); |
exampleframe = lookup_widget (preferencesdialog, "exampleframe"); |
766 |
setframestyle (exampleframe, color, preferences.themefont); |
setframestyle (exampleframe, col, preferences.themefont); |
767 |
|
g_free(col); |
768 |
examplelabel = lookup_widget (preferencesdialog, "examplelabel"); |
examplelabel = lookup_widget (preferencesdialog, "examplelabel"); |
769 |
setlabelstyle (examplelabel, color, preferences.themefont); |
setlabelstyle (examplelabel, col, preferences.themefont); |
770 |
g_free (colorblue); |
|
|
g_free (colorgreen); |
|
|
g_free (colorred); |
|
|
g_free (color); |
|
771 |
gtk_widget_set_sensitive (preferencesdialog, 1); |
gtk_widget_set_sensitive (preferencesdialog, 1); |
772 |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
773 |
} |
} |
804 |
on_pathselection_ok_button_clicked (GtkButton * button, gpointer user_data) |
on_pathselection_ok_button_clicked (GtkButton * button, gpointer user_data) |
805 |
{ |
{ |
806 |
GtkWidget *pathselection, *pathentry; |
GtkWidget *pathselection, *pathentry; |
807 |
gchar *selpath; |
G_CONST_RETURN gchar *selpath; |
808 |
|
|
809 |
pathselection = gtk_widget_get_toplevel (GTK_WIDGET (button)); |
pathselection = gtk_widget_get_toplevel (GTK_WIDGET (button)); |
810 |
selpath = |
selpath = |