70 |
gint globtype = 1; |
gint globtype = 1; |
71 |
|
|
72 |
#if WANT_HAMLIB |
#if WANT_HAMLIB |
73 |
extern GList *riglist; |
extern GList *riglist; |
74 |
extern gint hamlibtimer; |
extern gint hamlibtimer; |
75 |
extern RIG *myrig; |
extern RIG *myrig; |
76 |
#endif |
#endif |
77 |
|
|
78 |
/* ABOUT DIALOG */ |
/* ABOUT DIALOG */ |
79 |
void on_aboutbutton_clicked (GtkButton *button, gpointer user_data) |
void |
80 |
|
on_aboutbutton_clicked (GtkButton * button, gpointer user_data) |
81 |
{ |
{ |
82 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
83 |
} |
} |
84 |
|
|
85 |
|
|
87 |
|
|
88 |
#if WANT_HAMLIB |
#if WANT_HAMLIB |
89 |
/* return value for setting widgets */ |
/* return value for setting widgets */ |
90 |
static gint whichhamlibwidgets(gboolean frequency, gboolean smeter) |
static gint |
91 |
|
whichhamlibwidgets (gboolean frequency, gboolean smeter) |
92 |
{ |
{ |
93 |
if (frequency && smeter) return(4); |
if (frequency && smeter) |
94 |
else if (frequency && (!smeter)) return(2); |
return (4); |
95 |
else if ((!frequency) && smeter) return(3); |
else if (frequency && (!smeter)) |
96 |
else return(1); |
return (2); |
97 |
|
else if ((!frequency) && smeter) |
98 |
|
return (3); |
99 |
|
else |
100 |
|
return (1); |
101 |
} |
} |
102 |
#endif |
#endif |
103 |
|
|
104 |
/* check autosave value, if larger than 0 start timer */ |
/* check autosave value, if larger than 0 start timer */ |
105 |
static void set_autosave(gint value) |
static void |
106 |
|
set_autosave (gint value) |
107 |
{ |
{ |
108 |
if (preferences.autosave == 0) { |
if (preferences.autosave == 0) |
109 |
if (value > 0) |
{ |
110 |
savetimer = gtk_timeout_add(value*60*1000, (GtkFunction)autosave, NULL); |
if (value > 0) |
111 |
} |
savetimer = |
112 |
else { |
gtk_timeout_add (value * 60 * 1000, (GtkFunction) autosave, NULL); |
113 |
if (value == 0) { |
} |
114 |
gdk_input_remove(savetimer); |
else |
115 |
savetimer = -1; |
{ |
116 |
} |
if (value == 0) |
117 |
else if (value != preferences.autosave) { /* new value, stop and start timer */ |
{ |
118 |
gdk_input_remove(savetimer); |
gdk_input_remove (savetimer); |
119 |
savetimer = gtk_timeout_add(value*60*1000, (GtkFunction)autosave, NULL); |
savetimer = -1; |
120 |
} |
} |
121 |
|
else if (value != preferences.autosave) |
122 |
|
{ /* new value, stop and start timer */ |
123 |
|
gdk_input_remove (savetimer); |
124 |
|
savetimer = |
125 |
|
gtk_timeout_add (value * 60 * 1000, (GtkFunction) autosave, NULL); |
126 |
} |
} |
127 |
preferences.autosave = value; |
} |
128 |
|
preferences.autosave = value; |
129 |
} |
} |
130 |
|
|
131 |
/* set the theme if changed */ |
/* set the theme if changed */ |
132 |
static void set_theme(gchar *color, gchar *font, gboolean alsoforlog) |
static void |
133 |
|
set_theme (gchar * color, gchar * font, gboolean alsoforlog) |
134 |
{ |
{ |
135 |
GtkWidget *clocklabel, *qsoframe, *dxccframe; |
GtkWidget *clocklabel, *qsoframe, *dxccframe; |
136 |
gint i, row; |
gint i, row; |
137 |
logtype *logwindow; |
logtype *logwindow; |
138 |
gint logcolor; |
gint logcolor; |
139 |
gboolean logcolordone = FALSE; |
gboolean logcolordone = FALSE; |
140 |
GtkStyle *cellstyle; |
GtkStyle *cellstyle; |
141 |
#if WANT_HAMLIB |
#if WANT_HAMLIB |
142 |
GtkWidget *frequencylabel; |
GtkWidget *frequencylabel; |
143 |
#endif |
#endif |
144 |
|
|
145 |
logcolor = alsoforlog ? 1: 0; |
logcolor = alsoforlog ? 1 : 0; |
146 |
|
|
147 |
if (g_strcasecmp(color, preferences.themecolor) || |
if (g_strcasecmp (color, preferences.themecolor) || |
148 |
g_strcasecmp(font, preferences.themefont)) |
g_strcasecmp (font, preferences.themefont)) |
149 |
{ |
{ |
150 |
clocklabel = lookup_widget(mainwindow, "clocklabel"); |
clocklabel = lookup_widget (mainwindow, "clocklabel"); |
151 |
setlabelstyle(clocklabel, color, font); |
setlabelstyle (clocklabel, color, font); |
152 |
#if WANT_HAMLIB |
#if WANT_HAMLIB |
153 |
frequencylabel = lookup_widget(mainwindow, "frequencylabel"); |
frequencylabel = lookup_widget (mainwindow, "frequencylabel"); |
154 |
setlabelstyle(frequencylabel, color, font); |
setlabelstyle (frequencylabel, color, font); |
155 |
#endif |
#endif |
156 |
qsoframe = lookup_widget(mainwindow, "qsoframe"); |
qsoframe = lookup_widget (mainwindow, "qsoframe"); |
157 |
dxccframe = lookup_widget(mainwindow, "dxccframe"); |
dxccframe = lookup_widget (mainwindow, "dxccframe"); |
158 |
setframestyle(qsoframe, color, font); |
setframestyle (qsoframe, color, font); |
159 |
setframestyle(dxccframe, color, font); |
setframestyle (dxccframe, color, font); |
160 |
for (i = 0; i < g_list_length(logwindowlist); i++) |
for (i = 0; i < g_list_length (logwindowlist); i++) |
161 |
{ |
{ |
162 |
logwindow = g_list_nth_data(logwindowlist, i); |
logwindow = g_list_nth_data (logwindowlist, i); |
163 |
setlabelstyle(logwindow->label, color, font); |
setlabelstyle (logwindow->label, color, font); |
|
} |
|
|
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; |
|
|
} |
|
|
preferences.themecolor = color; |
|
|
preferences.themefont = g_strdup(font); |
|
164 |
} |
} |
165 |
|
if (alsoforlog) /* apply to the log if needed */ |
|
/* does the log need color? */ |
|
|
if (logcolor != preferences.logcolor) |
|
166 |
{ |
{ |
167 |
if ((logcolor == 1) && (!logcolordone)) |
for (i = 0; i < g_list_length (logwindowlist); i++) |
168 |
{ |
{ |
169 |
for (i = 0; i < g_list_length(logwindowlist); i++) |
logwindow = g_list_nth_data (logwindowlist, i); |
170 |
{ |
gtk_clist_freeze (GTK_CLIST (logwindow->clist)); |
171 |
logwindow = g_list_nth_data(logwindowlist, i); |
for (row = 0; row < logwindow->qsos; row++) |
172 |
gtk_clist_freeze(GTK_CLIST(logwindow->clist)); |
setcallstyle (logwindow->clist, row, color, font); |
173 |
for (row = 0 ; row < logwindow->qsos ; row++) |
gtk_clist_thaw (GTK_CLIST (logwindow->clist)); |
174 |
setcallstyle(logwindow->clist,row, |
} |
175 |
preferences.themecolor, preferences.themefont); |
logcolordone = TRUE; |
176 |
gtk_clist_thaw(GTK_CLIST(logwindow->clist)); |
} |
177 |
} |
preferences.themecolor = color; |
178 |
} |
preferences.themefont = g_strdup (font); |
179 |
if (logcolor == 0) |
} |
180 |
{ |
|
181 |
for (i = 0; i < g_list_length(logwindowlist); i++) |
/* does the log need color? */ |
182 |
{ |
if (logcolor != preferences.logcolor) |
183 |
logwindow = g_list_nth_data(logwindowlist, i); |
{ |
184 |
gtk_clist_freeze(GTK_CLIST(logwindow->clist)); |
if ((logcolor == 1) && (!logcolordone)) |
185 |
cellstyle = gtk_clist_get_cell_style(GTK_CLIST(logwindow->clist), 0, 0); |
{ |
186 |
for (row = 0 ; row < logwindow->qsos ; row++) |
for (i = 0; i < g_list_length (logwindowlist); i++) |
187 |
gtk_clist_set_cell_style(GTK_CLIST(logwindow->clist), row, CALL, |
{ |
188 |
cellstyle); |
logwindow = g_list_nth_data (logwindowlist, i); |
189 |
gtk_clist_thaw(GTK_CLIST(logwindow->clist)); |
gtk_clist_freeze (GTK_CLIST (logwindow->clist)); |
190 |
} |
for (row = 0; row < logwindow->qsos; row++) |
191 |
} |
setcallstyle (logwindow->clist, row, |
192 |
preferences.logcolor = logcolor; |
preferences.themecolor, preferences.themefont); |
193 |
|
gtk_clist_thaw (GTK_CLIST (logwindow->clist)); |
194 |
|
} |
195 |
|
} |
196 |
|
if (logcolor == 0) |
197 |
|
{ |
198 |
|
for (i = 0; i < g_list_length (logwindowlist); i++) |
199 |
|
{ |
200 |
|
logwindow = g_list_nth_data (logwindowlist, i); |
201 |
|
gtk_clist_freeze (GTK_CLIST (logwindow->clist)); |
202 |
|
cellstyle = |
203 |
|
gtk_clist_get_cell_style (GTK_CLIST (logwindow->clist), 0, 0); |
204 |
|
for (row = 0; row < logwindow->qsos; row++) |
205 |
|
gtk_clist_set_cell_style (GTK_CLIST (logwindow->clist), row, |
206 |
|
CALL, cellstyle); |
207 |
|
gtk_clist_thaw (GTK_CLIST (logwindow->clist)); |
208 |
|
} |
209 |
} |
} |
210 |
|
preferences.logcolor = logcolor; |
211 |
|
} |
212 |
} |
} |
213 |
|
|
214 |
/* set savepath if changed */ |
/* set savepath if changed */ |
215 |
static void set_path(gchar *pathstr) |
static void |
216 |
|
set_path (gchar * pathstr) |
217 |
{ |
{ |
218 |
gchar *str, *fpathstr; |
gchar *str, *fpathstr; |
219 |
GString *path; |
GString *path; |
220 |
|
|
221 |
if (strlen(pathstr) > 0) |
if (strlen (pathstr) > 0) |
222 |
{ |
{ |
223 |
path = g_string_new(pathstr); |
path = g_string_new (pathstr); |
224 |
str = g_strdup(path->str); |
str = g_strdup (path->str); |
225 |
/* remove trailing slash */ |
/* remove trailing slash */ |
226 |
g_strreverse(str); |
g_strreverse (str); |
227 |
if (!g_strncasecmp(str, "/", 1)) |
if (!g_strncasecmp (str, "/", 1)) |
228 |
{ |
{ |
229 |
path = g_string_erase(path, (path->len) -1, 1); |
path = g_string_erase (path, (path->len) - 1, 1); |
230 |
} |
} |
231 |
else /* in case a file is selected */ |
else /* in case a file is selected */ |
232 |
{ |
{ |
233 |
fpathstr = g_strdup(path->str); |
fpathstr = g_strdup (path->str); |
234 |
path = g_string_new(dirname(fpathstr)); |
path = g_string_new (dirname (fpathstr)); |
235 |
g_free(fpathstr); |
g_free (fpathstr); |
236 |
} |
} |
237 |
g_free(str); |
g_free (str); |
238 |
if (g_strcasecmp(preferences.savedir, path->str)) |
if (g_strcasecmp (preferences.savedir, path->str)) |
239 |
preferences.savedir = g_strdup(path->str); |
preferences.savedir = g_strdup (path->str); |
240 |
g_string_free(path, TRUE); |
g_string_free (path, TRUE); |
241 |
} |
} |
242 |
} |
} |
243 |
|
|
244 |
/* set logs to load if changed */ |
/* set logs to load if changed */ |
245 |
static void set_logstoload(gchar *logs) |
static void |
246 |
|
set_logstoload (gchar * logs) |
247 |
{ |
{ |
248 |
gchar **logsplit; |
gchar **logsplit; |
249 |
|
|
250 |
if (g_strcasecmp(logs, preferences.logstoload) != 0) |
if (g_strcasecmp (logs, preferences.logstoload) != 0) |
251 |
{ |
{ |
252 |
if (strlen(logs) == 0) |
if (strlen (logs) == 0) |
253 |
logs = g_strdup("*"); |
logs = g_strdup ("*"); |
254 |
logsplit = g_strsplit(logs, ",", -1); /* delete spaces */ |
logsplit = g_strsplit (logs, ",", -1); /* delete spaces */ |
255 |
deletespaces(logsplit); |
deletespaces (logsplit); |
256 |
preferences.logstoload = g_strjoinv(",", logsplit); |
preferences.logstoload = g_strjoinv (",", logsplit); |
257 |
g_strfreev(logsplit); |
g_strfreev (logsplit); |
258 |
} |
} |
259 |
} |
} |
260 |
|
|
261 |
/* set QTH locator */ |
/* set QTH locator */ |
262 |
static void set_qthlocator(gchar *locator) |
static void |
263 |
|
set_qthlocator (gchar * locator) |
264 |
{ |
{ |
265 |
if (g_strcasecmp(locator, preferences.locator) != 0) |
if (g_strcasecmp (locator, preferences.locator) != 0) |
266 |
{ |
{ |
267 |
if (strlen(locator) == 0) |
if (strlen (locator) == 0) |
268 |
locator = g_strdup("AA00AA"); |
locator = g_strdup ("AA00AA"); |
269 |
preferences.locator = g_strdup(locator); |
preferences.locator = g_strdup (locator); |
270 |
} |
} |
271 |
} |
} |
272 |
|
|
273 |
/* set callsign */ |
/* set callsign */ |
274 |
static void set_callsign(gchar *callsign) |
static void |
275 |
|
set_callsign (gchar * callsign) |
276 |
{ |
{ |
277 |
if (g_strcasecmp(callsign, preferences.callsign) != 0) |
if (g_strcasecmp (callsign, preferences.callsign) != 0) |
278 |
{ |
{ |
279 |
if (strlen(callsign) == 0) |
if (strlen (callsign) == 0) |
280 |
callsign = g_strdup("N0CALL"); |
callsign = g_strdup ("N0CALL"); |
281 |
preferences.callsign = g_strdup(callsign); |
preferences.callsign = g_strdup (callsign); |
282 |
} |
} |
283 |
} |
} |
284 |
|
|
285 |
/* enable/disable clock */ |
/* enable/disable clock */ |
286 |
static void set_clock(gboolean on) |
static void |
287 |
|
set_clock (gboolean on) |
288 |
{ |
{ |
289 |
GtkWidget *clocklabel, *clockpixmap, *clockhbox, *clockhandlebox; |
GtkWidget *clocklabel, *clockpixmap, *clockhbox, *clockhandlebox; |
290 |
|
|
291 |
clocklabel = lookup_widget(mainwindow, "clocklabel"); |
clocklabel = lookup_widget (mainwindow, "clocklabel"); |
292 |
clockpixmap = lookup_widget(mainwindow, "clockpixmap"); |
clockpixmap = lookup_widget (mainwindow, "clockpixmap"); |
293 |
clockhbox = lookup_widget(mainwindow, "clockhbox"); |
clockhbox = lookup_widget (mainwindow, "clockhbox"); |
294 |
clockhandlebox = lookup_widget(mainwindow, "clockhandlebox"); |
clockhandlebox = lookup_widget (mainwindow, "clockhandlebox"); |
295 |
if (on) { /* yes, we want clock */ |
if (on) |
296 |
if (preferences.clock == 0) |
{ /* yes, we want clock */ |
297 |
clocktimer = gtk_timeout_add(1000, (GtkFunction)updateclock, NULL); |
if (preferences.clock == 0) |
298 |
gtk_widget_show(clocklabel); |
clocktimer = gtk_timeout_add (1000, (GtkFunction) updateclock, NULL); |
299 |
gtk_widget_show(clockpixmap); |
gtk_widget_show (clocklabel); |
300 |
gtk_widget_show(clockhbox); |
gtk_widget_show (clockpixmap); |
301 |
gtk_widget_show(clockhandlebox); |
gtk_widget_show (clockhbox); |
302 |
preferences.clock = 1; |
gtk_widget_show (clockhandlebox); |
303 |
} |
preferences.clock = 1; |
304 |
else { /* no clock */ |
} |
305 |
if (preferences.clock > 0) gdk_input_remove(clocktimer); |
else |
306 |
clocktimer = -1; |
{ /* no clock */ |
307 |
gtk_widget_hide(clocklabel); |
if (preferences.clock > 0) |
308 |
gtk_widget_hide(clockpixmap); |
gdk_input_remove (clocktimer); |
309 |
gtk_widget_hide(clockhbox); |
clocktimer = -1; |
310 |
gtk_widget_hide(clockhandlebox); |
gtk_widget_hide (clocklabel); |
311 |
preferences.clock = 0; |
gtk_widget_hide (clockpixmap); |
312 |
} |
gtk_widget_hide (clockhbox); |
313 |
|
gtk_widget_hide (clockhandlebox); |
314 |
|
preferences.clock = 0; |
315 |
|
} |
316 |
} |
} |
317 |
|
|
318 |
/* ok button clicked */ |
/* ok button clicked */ |
319 |
void on_preferencesokbutton_clicked (GtkButton *button, gpointer user_data) |
void |
320 |
|
on_preferencesokbutton_clicked (GtkButton * button, gpointer user_data) |
321 |
{ |
{ |
322 |
GtkWidget *latentry, *longentry, *NScomboentry, *EWcomboentry, |
GtkWidget *latentry, *longentry, *NScomboentry, *EWcomboentry, |
323 |
*unitscomboentry, *bandsentry, *bandoptionmenu, *modesentry, |
*unitscomboentry, *bandsentry, *bandoptionmenu, *modesentry, |
324 |
*modeoptionmenu, *bandsradiobutton1, *modesradiobutton1, |
*modeoptionmenu, *bandsradiobutton1, *modesradiobutton1, |
325 |
*clockcheckbutton, *examplelabel, *autosavecomboentry, |
*clockcheckbutton, *examplelabel, *autosavecomboentry, |
326 |
*themecheckbutton, *pathentry, *logsentry, *qthlocatorentry, |
*themecheckbutton, *pathentry, *logsentry, *qthlocatorentry, |
327 |
*callsignentry, *fontentry, *bandentry, *modeentry; |
*callsignentry, *fontentry, *bandentry, *modeentry; |
328 |
gchar *temp, *bandcopy, *font; |
gchar *temp, *bandcopy, *font; |
329 |
gboolean toggletrue, logcoloryesno; |
gboolean toggletrue, logcoloryesno; |
330 |
gint bandindex = 0, modeindex = 0, autosavevalue; |
gint bandindex = 0, modeindex = 0, autosavevalue; |
331 |
#if WANT_HAMLIB |
#if WANT_HAMLIB |
332 |
GtkWidget *hamlibcheckbutton, *radiocomboentry, *devicecomboentry, |
GtkWidget *hamlibcheckbutton, *radiocomboentry, *devicecomboentry, |
333 |
*frequencycheckbutton, *digitscomboentry, *smetercheckbutton, *drawingarea; |
*frequencycheckbutton, *digitscomboentry, *smetercheckbutton, |
334 |
gchar *radio = NULL, *device = NULL, *digits = NULL; |
*drawingarea; |
335 |
gboolean hamlibyes, frequencyyesno, smeteryesno; |
gchar *radio = NULL, *device = NULL, *digits = NULL; |
336 |
gint rigid, retcode; |
gboolean hamlibyes, frequencyyesno, smeteryesno; |
337 |
gint hamlibwidgets = 0; |
gint rigid, retcode; |
338 |
|
gint hamlibwidgets = 0; |
339 |
#endif |
#endif |
340 |
|
|
341 |
/* check autosave value */ |
/* check autosave value */ |
342 |
autosavecomboentry = lookup_widget(preferencesdialog, "autosavecomboentry"); |
autosavecomboentry = |
343 |
temp = gtk_editable_get_chars(GTK_EDITABLE(autosavecomboentry), 0, -1); |
lookup_widget (preferencesdialog, "autosavecomboentry"); |
344 |
autosavevalue = atoi(temp); |
temp = gtk_editable_get_chars (GTK_EDITABLE (autosavecomboentry), 0, -1); |
345 |
set_autosave(autosavevalue); |
autosavevalue = atoi (temp); |
346 |
|
set_autosave (autosavevalue); |
347 |
/* apply theme color */ |
|
348 |
fontentry = lookup_widget(preferencesdialog, "fontentry"); |
/* apply theme color */ |
349 |
examplelabel = lookup_widget(preferencesdialog, "examplelabel"); |
fontentry = lookup_widget (preferencesdialog, "fontentry"); |
350 |
themecheckbutton =lookup_widget(preferencesdialog, "themecheckbutton"); |
examplelabel = lookup_widget (preferencesdialog, "examplelabel"); |
351 |
logcoloryesno = gtk_toggle_button_get_active |
themecheckbutton = lookup_widget (preferencesdialog, "themecheckbutton"); |
352 |
(GTK_TOGGLE_BUTTON(themecheckbutton)); |
logcoloryesno = gtk_toggle_button_get_active |
353 |
temp = getlabelcolor(examplelabel); |
(GTK_TOGGLE_BUTTON (themecheckbutton)); |
354 |
font = gtk_editable_get_chars(GTK_EDITABLE(fontentry), 0, -1); |
temp = getlabelcolor (examplelabel); |
355 |
set_theme(temp, font, logcoloryesno); |
font = gtk_editable_get_chars (GTK_EDITABLE (fontentry), 0, -1); |
356 |
g_free(font); |
set_theme (temp, font, logcoloryesno); |
357 |
|
g_free (font); |
358 |
/* get path for the logs */ |
|
359 |
pathentry = lookup_widget(preferencesdialog, "pathentry"); |
/* get path for the logs */ |
360 |
temp = gtk_editable_get_chars(GTK_EDITABLE(pathentry), 0, -1); |
pathentry = lookup_widget (preferencesdialog, "pathentry"); |
361 |
set_path(temp); |
temp = gtk_editable_get_chars (GTK_EDITABLE (pathentry), 0, -1); |
362 |
|
set_path (temp); |
363 |
/* get logs to load */ |
|
364 |
logsentry = lookup_widget(preferencesdialog, "logsentry"); |
/* get logs to load */ |
365 |
temp = gtk_editable_get_chars(GTK_EDITABLE(logsentry), 0, -1); |
logsentry = lookup_widget (preferencesdialog, "logsentry"); |
366 |
set_logstoload(temp); |
temp = gtk_editable_get_chars (GTK_EDITABLE (logsentry), 0, -1); |
367 |
|
set_logstoload (temp); |
368 |
/* locator */ |
|
369 |
qthlocatorentry = lookup_widget(preferencesdialog, "qthlocatorentry"); |
/* locator */ |
370 |
temp = gtk_editable_get_chars(GTK_EDITABLE(qthlocatorentry), 0, -1); |
qthlocatorentry = lookup_widget (preferencesdialog, "qthlocatorentry"); |
371 |
set_qthlocator(temp); |
temp = gtk_editable_get_chars (GTK_EDITABLE (qthlocatorentry), 0, -1); |
372 |
|
set_qthlocator (temp); |
373 |
/* callsign */ |
|
374 |
callsignentry = lookup_widget(preferencesdialog, "callsignentry"); |
/* callsign */ |
375 |
temp = gtk_editable_get_chars(GTK_EDITABLE(callsignentry), 0, -1); |
callsignentry = lookup_widget (preferencesdialog, "callsignentry"); |
376 |
set_callsign(temp); |
temp = gtk_editable_get_chars (GTK_EDITABLE (callsignentry), 0, -1); |
377 |
|
set_callsign (temp); |
378 |
/* set latitude, longitude and units */ |
|
379 |
latentry = lookup_widget(preferencesdialog, "latentry"); |
/* set latitude, longitude and units */ |
380 |
longentry = lookup_widget(preferencesdialog, "longentry"); |
latentry = lookup_widget (preferencesdialog, "latentry"); |
381 |
NScomboentry = lookup_widget(preferencesdialog, "NScomboentry"); |
longentry = lookup_widget (preferencesdialog, "longentry"); |
382 |
EWcomboentry = lookup_widget(preferencesdialog, "EWcomboentry"); |
NScomboentry = lookup_widget (preferencesdialog, "NScomboentry"); |
383 |
unitscomboentry = lookup_widget(preferencesdialog, "unitscomboentry"); |
EWcomboentry = lookup_widget (preferencesdialog, "EWcomboentry"); |
384 |
temp = gtk_editable_get_chars(GTK_EDITABLE(latentry), 0, -1); |
unitscomboentry = lookup_widget (preferencesdialog, "unitscomboentry"); |
385 |
g_strstrip(temp); |
temp = gtk_editable_get_chars (GTK_EDITABLE (latentry), 0, -1); |
386 |
if (strlen(temp) == 0) preferences.latitude = 0.0; |
g_strstrip (temp); |
387 |
else preferences.latitude = atof(temp); |
if (strlen (temp) == 0) |
388 |
temp = gtk_editable_get_chars(GTK_EDITABLE(longentry), 0, -1); |
preferences.latitude = 0.0; |
389 |
g_strstrip(temp); |
else |
390 |
if (strlen(temp) == 0) preferences.longitude = 0.0; |
preferences.latitude = atof (temp); |
391 |
else preferences.longitude = atof(temp); |
temp = gtk_editable_get_chars (GTK_EDITABLE (longentry), 0, -1); |
392 |
temp = gtk_editable_get_chars(GTK_EDITABLE(NScomboentry), 0, 1); |
g_strstrip (temp); |
393 |
if (g_strncasecmp(temp, _("N"), 1) == 0) preferences.NS = 1; |
if (strlen (temp) == 0) |
394 |
else preferences.NS = 2; |
preferences.longitude = 0.0; |
395 |
temp = gtk_editable_get_chars(GTK_EDITABLE(EWcomboentry), 0, 1); |
else |
396 |
if (g_strncasecmp(temp, _("E"), 1) == 0) preferences.EW = 1; |
preferences.longitude = atof (temp); |
397 |
else preferences.EW = 2; |
temp = gtk_editable_get_chars (GTK_EDITABLE (NScomboentry), 0, 1); |
398 |
temp = gtk_editable_get_chars(GTK_EDITABLE(unitscomboentry), 0, -1); |
if (g_strncasecmp (temp, _("N"), 1) == 0) |
399 |
if (g_strncasecmp(temp, "K", 1) == 0) preferences.units = 1; |
preferences.NS = 1; |
400 |
else preferences.units = 0; |
else |
401 |
state.mylocation = setlocation(preferences.latitude, preferences.NS, |
preferences.NS = 2; |
402 |
preferences.longitude, preferences.EW); |
temp = gtk_editable_get_chars (GTK_EDITABLE (EWcomboentry), 0, 1); |
403 |
/* get the comma seperated list of modes and assign to the optionmenu */ |
if (g_strncasecmp (temp, _("E"), 1) == 0) |
404 |
modesentry = lookup_widget(preferencesdialog, "modesentry"); |
preferences.EW = 1; |
405 |
modeoptionmenu = lookup_widget(mainwindow, "modeoptionmenu"); |
else |
406 |
temp = gtk_editable_get_chars(GTK_EDITABLE(modesentry), 0, -1); |
preferences.EW = 2; |
407 |
modesplit = g_strsplit(temp, ",", 0); |
temp = gtk_editable_get_chars (GTK_EDITABLE (unitscomboentry), 0, -1); |
408 |
deletespaces(modesplit); |
if (g_strncasecmp (temp, "K", 1) == 0) |
409 |
updateoptionmenu(modeoptionmenu, modesplit); |
preferences.units = 1; |
410 |
|
else |
411 |
/* set the optionmenu for modes */ |
preferences.units = 0; |
412 |
modeentry = lookup_widget(mainwindow, "modeentry"); |
state.mylocation = setlocation (preferences.latitude, preferences.NS, |
413 |
temp = gtk_editable_get_chars(GTK_EDITABLE(modeentry), 0, -1); |
preferences.longitude, preferences.EW); |
414 |
if (strlen(temp) > 0) |
/* get the comma seperated list of modes and assign to the optionmenu */ |
415 |
|
modesentry = lookup_widget (preferencesdialog, "modesentry"); |
416 |
|
modeoptionmenu = lookup_widget (mainwindow, "modeoptionmenu"); |
417 |
|
temp = gtk_editable_get_chars (GTK_EDITABLE (modesentry), 0, -1); |
418 |
|
modesplit = g_strsplit (temp, ",", 0); |
419 |
|
deletespaces (modesplit); |
420 |
|
updateoptionmenu (modeoptionmenu, modesplit); |
421 |
|
|
422 |
|
/* set the optionmenu for modes */ |
423 |
|
modeentry = lookup_widget (mainwindow, "modeentry"); |
424 |
|
temp = gtk_editable_get_chars (GTK_EDITABLE (modeentry), 0, -1); |
425 |
|
if (strlen (temp) > 0) |
426 |
|
{ |
427 |
|
for (;;) |
428 |
{ |
{ |
429 |
for (;;) |
if (g_strcasecmp (temp, modesplit[modeindex]) == 0) |
430 |
{ |
{ |
431 |
if (g_strcasecmp(temp, modesplit[modeindex]) == 0) |
gtk_option_menu_set_history (GTK_OPTION_MENU (modeoptionmenu), |
432 |
{ |
modeindex); |
433 |
gtk_option_menu_set_history(GTK_OPTION_MENU(modeoptionmenu), modeindex); |
break; |
434 |
break; |
} |
435 |
} |
modeindex++; |
|
modeindex++; |
|
|
} |
|
436 |
} |
} |
437 |
|
} |
438 |
|
|
439 |
/* get the comma seperated list of bands and assign to the optionmenu */ |
/* get the comma seperated list of bands and assign to the optionmenu */ |
440 |
bandsentry = lookup_widget(preferencesdialog, "bandsentry"); |
bandsentry = lookup_widget (preferencesdialog, "bandsentry"); |
441 |
bandoptionmenu = lookup_widget(mainwindow, "bandoptionmenu"); |
bandoptionmenu = lookup_widget (mainwindow, "bandoptionmenu"); |
442 |
temp = gtk_editable_get_chars(GTK_EDITABLE(bandsentry), 0, -1); |
temp = gtk_editable_get_chars (GTK_EDITABLE (bandsentry), 0, -1); |
443 |
bandsplit = g_strsplit(temp, ",", 0); |
bandsplit = g_strsplit (temp, ",", 0); |
444 |
deletespaces(bandsplit); |
deletespaces (bandsplit); |
445 |
updateoptionmenu(bandoptionmenu, bandsplit); |
updateoptionmenu (bandoptionmenu, bandsplit); |
446 |
|
|
447 |
/* set the optionmenu for bands in the main window */ |
/* set the optionmenu for bands in the main window */ |
448 |
bandentry = lookup_widget(mainwindow, "bandentry"); |
bandentry = lookup_widget (mainwindow, "bandentry"); |
449 |
temp = gtk_editable_get_chars(GTK_EDITABLE(bandentry), 0, -1); |
temp = gtk_editable_get_chars (GTK_EDITABLE (bandentry), 0, -1); |
450 |
if (strlen(temp) > 0) { |
if (strlen (temp) > 0) |
451 |
if (strlen(temp) <= 2) bandcopy = g_strdup(temp); |
{ |
452 |
else bandcopy = finddot(temp); |
if (strlen (temp) <= 2) |
453 |
if (atoi(bandcopy) < 29) { /* only support HF bands for now */ |
bandcopy = g_strdup (temp); |
454 |
for (;;) |
else |
455 |
{ |
bandcopy = finddot (temp); |
456 |
if (g_strcasecmp(bandcopy, bandsplit[bandindex]) == 0) |
if (atoi (bandcopy) < 29) |
457 |
{ |
{ /* only support HF bands for now */ |
458 |
gtk_option_menu_set_history(GTK_OPTION_MENU(bandoptionmenu), bandindex); |
for (;;) |
459 |
break; |
{ |
460 |
} |
if (g_strcasecmp (bandcopy, bandsplit[bandindex]) == 0) |
461 |
bandindex++; |
{ |
462 |
} |
gtk_option_menu_set_history (GTK_OPTION_MENU |
463 |
|
(bandoptionmenu), bandindex); |
464 |
|
break; |
465 |
} |
} |
466 |
g_free(bandcopy); |
bandindex++; |
467 |
|
} |
468 |
} |
} |
469 |
|
g_free (bandcopy); |
470 |
|
} |
471 |
|
|
472 |
preferences.modes = g_strjoinv(",", modesplit); |
preferences.modes = g_strjoinv (",", modesplit); |
473 |
preferences.bands = g_strjoinv(",", bandsplit); |
preferences.bands = g_strjoinv (",", bandsplit); |
474 |
|
|
475 |
/* set visibility of widgets in QSO frame depending on state of toggle buttons */ |
/* set visibility of widgets in QSO frame depending on state of toggle buttons */ |
476 |
bandsradiobutton1 = lookup_widget(preferencesdialog, "bandsradiobutton1"); |
bandsradiobutton1 = lookup_widget (preferencesdialog, "bandsradiobutton1"); |
477 |
toggletrue = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bandsradiobutton1)); |
toggletrue = |
478 |
if (toggletrue) |
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (bandsradiobutton1)); |
479 |
{ |
if (toggletrue) |
480 |
preferences.bandseditbox = 1; |
{ |
481 |
gtk_widget_hide(bandoptionmenu); |
preferences.bandseditbox = 1; |
482 |
gtk_widget_show(bandentry); |
gtk_widget_hide (bandoptionmenu); |
483 |
} |
gtk_widget_show (bandentry); |
484 |
else |
} |
485 |
{ |
else |
486 |
preferences.bandseditbox = 0; |
{ |
487 |
gtk_widget_hide(bandentry); |
preferences.bandseditbox = 0; |
488 |
gtk_widget_show(bandoptionmenu); |
gtk_widget_hide (bandentry); |
489 |
} |
gtk_widget_show (bandoptionmenu); |
490 |
modesradiobutton1 = lookup_widget(preferencesdialog, "modesradiobutton1"); |
} |
491 |
toggletrue = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(modesradiobutton1)); |
modesradiobutton1 = lookup_widget (preferencesdialog, "modesradiobutton1"); |
492 |
if (toggletrue) |
toggletrue = |
493 |
{ |
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (modesradiobutton1)); |
494 |
preferences.modeseditbox = 1; |
if (toggletrue) |
495 |
gtk_widget_hide(modeoptionmenu); |
{ |
496 |
gtk_widget_show(modeentry); |
preferences.modeseditbox = 1; |
497 |
} |
gtk_widget_hide (modeoptionmenu); |
498 |
else |
gtk_widget_show (modeentry); |
499 |
{ |
} |
500 |
preferences.modeseditbox = 0; |
else |
501 |
gtk_widget_hide(modeentry); |
{ |
502 |
gtk_widget_show(modeoptionmenu); |
preferences.modeseditbox = 0; |
503 |
} |
gtk_widget_hide (modeentry); |
504 |
|
gtk_widget_show (modeoptionmenu); |
505 |
|
} |
506 |
|
|
507 |
#if WANT_HAMLIB |
#if WANT_HAMLIB |
508 |
hamlibcheckbutton = lookup_widget(preferencesdialog, "hamlibcheckbutton"); |
hamlibcheckbutton = lookup_widget (preferencesdialog, "hamlibcheckbutton"); |
509 |
frequencycheckbutton = lookup_widget(preferencesdialog, "frequencycheckbutton"); |
frequencycheckbutton = |
510 |
smetercheckbutton = lookup_widget(preferencesdialog, "smetercheckbutton"); |
lookup_widget (preferencesdialog, "frequencycheckbutton"); |
511 |
radiocomboentry = lookup_widget(preferencesdialog, "radiocomboentry"); |
smetercheckbutton = lookup_widget (preferencesdialog, "smetercheckbutton"); |
512 |
devicecomboentry = lookup_widget(preferencesdialog, "devicecomboentry"); |
radiocomboentry = lookup_widget (preferencesdialog, "radiocomboentry"); |
513 |
digitscomboentry = lookup_widget(preferencesdialog, "digitscomboentry"); |
devicecomboentry = lookup_widget (preferencesdialog, "devicecomboentry"); |
514 |
hamlibyes = gtk_toggle_button_get_active |
digitscomboentry = lookup_widget (preferencesdialog, "digitscomboentry"); |
515 |
(GTK_TOGGLE_BUTTON(hamlibcheckbutton)); |
hamlibyes = gtk_toggle_button_get_active |
516 |
frequencyyesno = gtk_toggle_button_get_active |
(GTK_TOGGLE_BUTTON (hamlibcheckbutton)); |
517 |
(GTK_TOGGLE_BUTTON(frequencycheckbutton)); |
frequencyyesno = gtk_toggle_button_get_active |
518 |
smeteryesno = gtk_toggle_button_get_active |
(GTK_TOGGLE_BUTTON (frequencycheckbutton)); |
519 |
(GTK_TOGGLE_BUTTON(smetercheckbutton)); |
smeteryesno = gtk_toggle_button_get_active |
520 |
radio = gtk_editable_get_chars(GTK_EDITABLE(radiocomboentry), 0, -1); |
(GTK_TOGGLE_BUTTON (smetercheckbutton)); |
521 |
device = gtk_editable_get_chars(GTK_EDITABLE(devicecomboentry), 0, -1); |
radio = gtk_editable_get_chars (GTK_EDITABLE (radiocomboentry), 0, -1); |
522 |
digits = gtk_editable_get_chars(GTK_EDITABLE(digitscomboentry), 0, -1); |
device = gtk_editable_get_chars (GTK_EDITABLE (devicecomboentry), 0, -1); |
523 |
|
digits = gtk_editable_get_chars (GTK_EDITABLE (digitscomboentry), 0, -1); |
524 |
if ((preferences.hamlib == 0) && hamlibyes) |
|
525 |
{ |
if ((preferences.hamlib == 0) && hamlibyes) |
526 |
/* first use of hamlib, open radio */ |
{ |
527 |
rigid = get_rigid(radio); |
/* first use of hamlib, open radio */ |
528 |
if (rigid != -1) |
rigid = get_rigid (radio); |
529 |
{ |
if (rigid != -1) |
530 |
myrig = rig_init(rigid); |
{ |
531 |
strncpy(myrig->state.rigport.pathname, device, FILPATHLEN); |
myrig = rig_init (rigid); |
532 |
retcode = rig_open(myrig); |
strncpy (myrig->state.rigport.pathname, device, FILPATHLEN); |
533 |
if (retcode != RIG_OK) |
retcode = rig_open (myrig); |
534 |
{ |
if (retcode != RIG_OK) |
535 |
temp = g_strdup_printf (_("An error occured while opening port %s: %s"), |
{ |
536 |
myrig->state.rigport.pathname, rigerror(retcode)); |
temp = |
537 |
update_statusbar(temp); |
g_strdup_printf (_ |
538 |
} |
("An error occured while opening port %s: %s"), |
539 |
else |
myrig->state.rigport.pathname, |
540 |
{ |
rigerror (retcode)); |
541 |
hamlibtimer = gtk_timeout_add(200, (GtkFunction)get_riginfo, NULL); |
update_statusbar (temp); |
542 |
} |
} |
543 |
preferences.radio = g_strdup(radio); |
else |
544 |
preferences.device = g_strdup(device); |
{ |
545 |
preferences.round = atoi(digits); |
hamlibtimer = |
546 |
hamlibwidgets = whichhamlibwidgets(frequencyyesno, smeteryesno); |
gtk_timeout_add (200, (GtkFunction) get_riginfo, NULL); |
547 |
} |
} |
548 |
else |
preferences.radio = g_strdup (radio); |
549 |
{ |
preferences.device = g_strdup (device); |
550 |
update_statusbar(_("Hamlib error: get_rigid failed")); |
preferences.round = atoi (digits); |
551 |
} |
hamlibwidgets = whichhamlibwidgets (frequencyyesno, smeteryesno); |
552 |
} |
} |
553 |
else if ((preferences.hamlib > 0) && hamlibyes) |
else |
554 |
{ |
{ |
555 |
/* see if we have selected another radio or port */ |
update_statusbar (_("Hamlib error: get_rigid failed")); |
556 |
if ((g_strcasecmp(radio, preferences.radio) != 0) |
} |
557 |
|| (g_strcasecmp(device, preferences.device) != 0)) |
} |
558 |
{ |
else if ((preferences.hamlib > 0) && hamlibyes) |
559 |
gdk_input_remove(hamlibtimer); |
{ |
560 |
rig_close((RIG *)myrig); |
/* see if we have selected another radio or port */ |
561 |
rig_cleanup((RIG *)myrig); |
if ((g_strcasecmp (radio, preferences.radio) != 0) |
562 |
rigid = get_rigid(radio); |
|| (g_strcasecmp (device, preferences.device) != 0)) |
563 |
myrig = rig_init(rigid); |
{ |
564 |
strncpy(myrig->state.rigport.pathname, device, FILPATHLEN); |
gdk_input_remove (hamlibtimer); |
565 |
retcode = rig_open(myrig); |
rig_close ((RIG *) myrig); |
566 |
if (retcode != RIG_OK) |
rig_cleanup ((RIG *) myrig); |
567 |
{ |
rigid = get_rigid (radio); |
568 |
temp = g_strdup_printf ("An error occured while opening port %s: %s", |
myrig = rig_init (rigid); |
569 |
myrig->state.rigport.pathname, rigerror(retcode)); |
strncpy (myrig->state.rigport.pathname, device, FILPATHLEN); |
570 |
update_statusbar(temp); |
retcode = rig_open (myrig); |
571 |
} |
if (retcode != RIG_OK) |
572 |
else |
{ |
573 |
{ |
temp = |
574 |
hamlibtimer = gtk_timeout_add(200, (GtkFunction)get_riginfo, NULL); |
g_strdup_printf ("An error occured while opening port %s: %s", |
575 |
} |
myrig->state.rigport.pathname, |
576 |
} |
rigerror (retcode)); |
577 |
preferences.radio = g_strdup(radio); |
update_statusbar (temp); |
578 |
preferences.device = g_strdup(device); |
} |
579 |
preferences.round = atoi(digits); |
else |
580 |
hamlibwidgets = whichhamlibwidgets(frequencyyesno, smeteryesno); |
{ |
581 |
} |
hamlibtimer = |
582 |
else if ((preferences.hamlib > 0) && !hamlibyes) |
gtk_timeout_add (200, (GtkFunction) get_riginfo, NULL); |
583 |
{ |
} |
|
/* hamlib disabled, close rig */ |
|
|
hamlibwidgets = 0; |
|
|
gdk_input_remove(hamlibtimer); |
|
|
hamlibtimer = -1; |
|
|
rig_close((RIG *)myrig); |
|
|
rig_cleanup((RIG *)myrig); |
|
|
preferences.radio = g_strdup("Dummy"); |
|
|
preferences.device = g_strdup("/dev/ttyS1"); |
|
|
preferences.round = 0; |
|
|
} |
|
|
else if ((preferences.hamlib = 0) && !hamlibyes) |
|
|
{ |
|
|
preferences.radio = g_strdup("Dummy"); |
|
|
preferences.device = g_strdup("/dev/ttyS1"); |
|
|
preferences.round = 0; |
|
|
} |
|
|
|
|
|
/* set widgets if they are changed */ |
|
|
if (hamlibwidgets != preferences.hamlib) |
|
|
{ |
|
|
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); |
|
|
} |
|
|
preferences.hamlib = hamlibwidgets; |
|
584 |
} |
} |
585 |
g_free(radio); |
preferences.radio = g_strdup (radio); |
586 |
g_free(device); |
preferences.device = g_strdup (device); |
587 |
g_free(digits); |
preferences.round = atoi (digits); |
588 |
|
hamlibwidgets = whichhamlibwidgets (frequencyyesno, smeteryesno); |
589 |
|
} |
590 |
|
else if ((preferences.hamlib > 0) && !hamlibyes) |
591 |
|
{ |
592 |
|
/* hamlib disabled, close rig */ |
593 |
|
hamlibwidgets = 0; |
594 |
|
gdk_input_remove (hamlibtimer); |
595 |
|
hamlibtimer = -1; |
596 |
|
rig_close ((RIG *) myrig); |
597 |
|
rig_cleanup ((RIG *) myrig); |
598 |
|
preferences.radio = g_strdup ("Dummy"); |
599 |
|
preferences.device = g_strdup ("/dev/ttyS1"); |
600 |
|
preferences.round = 0; |
601 |
|
} |
602 |
|
else if ((preferences.hamlib = 0) && !hamlibyes) |
603 |
|
{ |
604 |
|
preferences.radio = g_strdup ("Dummy"); |
605 |
|
preferences.device = g_strdup ("/dev/ttyS1"); |
606 |
|
preferences.round = 0; |
607 |
|
} |
608 |
|
|
609 |
|
/* set widgets if they are changed */ |
610 |
|
if (hamlibwidgets != preferences.hamlib) |
611 |
|
{ |
612 |
|
sethamlibwidgets (hamlibwidgets); |
613 |
|
/* pixmaps need to be loaded if s-meter is enabled and was disabled before */ |
614 |
|
if (((hamlibwidgets == 3) || (hamlibwidgets == 4)) |
615 |
|
&& ((preferences.hamlib == 0) || (preferences.hamlib == 1) |
616 |
|
|| (preferences.hamlib == 2))) |
617 |
|
{ |
618 |
|
drawingarea = lookup_widget (mainwindow, "smeterdrawingarea"); |
619 |
|
loadsmeter (drawingarea); |
620 |
|
} |
621 |
|
preferences.hamlib = hamlibwidgets; |
622 |
|
} |
623 |
|
g_free (radio); |
624 |
|
g_free (device); |
625 |
|
g_free (digits); |
626 |
#endif |
#endif |
627 |
|
|
628 |
/* clock */ |
/* clock */ |
629 |
clockcheckbutton = lookup_widget(preferencesdialog, "clockcheckbutton"); |
clockcheckbutton = lookup_widget (preferencesdialog, "clockcheckbutton"); |
630 |
toggletrue = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(clockcheckbutton)); |
toggletrue = |
631 |
set_clock(toggletrue); |
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (clockcheckbutton)); |
632 |
|
set_clock (toggletrue); |
633 |
g_free(temp); |
|
634 |
gtk_widget_set_sensitive(mainwindow, 1); |
g_free (temp); |
635 |
gtk_widget_destroy(preferencesdialog); |
gtk_widget_set_sensitive (mainwindow, 1); |
636 |
|
gtk_widget_destroy (preferencesdialog); |
637 |
} |
} |
638 |
|
|
639 |
/* toggle hamlib widgets in the preferences dialog */ |
/* toggle hamlib widgets in the preferences dialog */ |
640 |
void on_hamlibcheckbutton_toggled (GtkToggleButton *togglebutton, gpointer user_data) |
void |
641 |
{ |
on_hamlibcheckbutton_toggled (GtkToggleButton * togglebutton, |
642 |
GtkWidget *hamlibframe; |
gpointer user_data) |
643 |
gboolean toggletrue; |
{ |
644 |
|
GtkWidget *hamlibframe; |
645 |
hamlibframe = lookup_widget(preferencesdialog, "hamlibframe"); |
gboolean toggletrue; |
646 |
toggletrue = gtk_toggle_button_get_active(togglebutton); |
|
647 |
if (toggletrue) |
hamlibframe = lookup_widget (preferencesdialog, "hamlibframe"); |
648 |
gtk_widget_set_sensitive(hamlibframe, 1); |
toggletrue = gtk_toggle_button_get_active (togglebutton); |
649 |
else |
if (toggletrue) |
650 |
gtk_widget_set_sensitive(hamlibframe, 0); |
gtk_widget_set_sensitive (hamlibframe, 1); |
651 |
|
else |
652 |
|
gtk_widget_set_sensitive (hamlibframe, 0); |
653 |
} |
} |
654 |
|
|
655 |
/* cancel the preferences dialog */ |
/* cancel the preferences dialog */ |
656 |
void on_preferencescancelbutton_clicked (GtkButton *button, gpointer user_data) |
void |
657 |
|
on_preferencescancelbutton_clicked (GtkButton * button, gpointer user_data) |
658 |
{ |
{ |
659 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
660 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
661 |
} |
} |
662 |
|
|
663 |
/* the preferences dialog is deleted */ |
/* the preferences dialog is deleted */ |
664 |
gboolean on_preferencesdialog_delete_event (GtkWidget *widget, GdkEvent *event, |
gboolean |
665 |
gpointer user_data) |
on_preferencesdialog_delete_event (GtkWidget * widget, GdkEvent * event, |
666 |
|
gpointer user_data) |
667 |
{ |
{ |
668 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
669 |
return FALSE; |
return FALSE; |
670 |
} |
} |
671 |
|
|
672 |
/* toggle sensistivity of band widgets in preferences dialog */ |
/* toggle sensistivity of band widgets in preferences dialog */ |
673 |
void on_bandsradiobutton_toggled (GtkToggleButton *togglebutton, |
void |
674 |
gpointer user_data) |
on_bandsradiobutton_toggled (GtkToggleButton * togglebutton, |
675 |
{ |
gpointer user_data) |
676 |
GtkWidget *bandslabel, *bandsentry; |
{ |
677 |
|
GtkWidget *bandslabel, *bandsentry; |
678 |
bandslabel = lookup_widget(preferencesdialog, "bandslabel"); |
|
679 |
bandsentry = lookup_widget(preferencesdialog, "bandsentry"); |
bandslabel = lookup_widget (preferencesdialog, "bandslabel"); |
680 |
switch(atoi(user_data)) |
bandsentry = lookup_widget (preferencesdialog, "bandsentry"); |
681 |
{ |
switch (atoi (user_data)) |
682 |
case 1: |
{ |
683 |
gtk_widget_set_sensitive(bandslabel, 0); |
case 1: |
684 |
gtk_widget_set_sensitive(bandsentry, 0); |
gtk_widget_set_sensitive (bandslabel, 0); |
685 |
break; |
gtk_widget_set_sensitive (bandsentry, 0); |
686 |
case 2: |
break; |
687 |
gtk_widget_set_sensitive(bandslabel, 1); |
case 2: |
688 |
gtk_widget_set_sensitive(bandsentry, 1); |
gtk_widget_set_sensitive (bandslabel, 1); |
689 |
break; |
gtk_widget_set_sensitive (bandsentry, 1); |
690 |
} |
break; |
691 |
|
} |
692 |
} |
} |
693 |
|
|
694 |
/* toggle sensistivity of modes widgets in preferences dialog */ |
/* toggle sensistivity of modes widgets in preferences dialog */ |
695 |
void on_modesradiobutton_toggled (GtkToggleButton *togglebutton, |
void |
696 |
gpointer user_data) |
on_modesradiobutton_toggled (GtkToggleButton * togglebutton, |
697 |
{ |
gpointer user_data) |
698 |
GtkWidget *modeslabel, *modesentry; |
{ |
699 |
|
GtkWidget *modeslabel, *modesentry; |
700 |
modeslabel = lookup_widget(preferencesdialog, "modeslabel"); |
|
701 |
modesentry = lookup_widget(preferencesdialog, "modesentry"); |
modeslabel = lookup_widget (preferencesdialog, "modeslabel"); |
702 |
switch(atoi(user_data)) |
modesentry = lookup_widget (preferencesdialog, "modesentry"); |
703 |
{ |
switch (atoi (user_data)) |
704 |
case 1: |
{ |
705 |
gtk_widget_set_sensitive(modeslabel, 0); |
case 1: |
706 |
gtk_widget_set_sensitive(modesentry, 0); |
gtk_widget_set_sensitive (modeslabel, 0); |
707 |
break; |
gtk_widget_set_sensitive (modesentry, 0); |
708 |
case 2: |
break; |
709 |
gtk_widget_set_sensitive(modeslabel, 1); |
case 2: |
710 |
gtk_widget_set_sensitive(modesentry, 1); |
gtk_widget_set_sensitive (modeslabel, 1); |
711 |
break; |
gtk_widget_set_sensitive (modesentry, 1); |
712 |
} |
break; |
713 |
|
} |
714 |
|
|
715 |
} |
} |
716 |
|
|
717 |
/* show color selection dialog and apply the theme color */ |
/* show color selection dialog and apply the theme color */ |
718 |
void on_themebutton_clicked(GtkButton *button, gpointer user_data) |
void |
719 |
|
on_themebutton_clicked (GtkButton * button, gpointer user_data) |
720 |
{ |
{ |
721 |
GtkWidget *colorselectiondialog; |
GtkWidget *colorselectiondialog; |
722 |
gdouble rgb[3]; |
gdouble rgb[3]; |
723 |
gchar *themecolor; |
gchar *themecolor; |
724 |
GdkColor color; |
GdkColor color; |
725 |
|
|
726 |
colorselectiondialog = create_colorselectiondialog(); |
colorselectiondialog = create_colorselectiondialog (); |
727 |
gtk_widget_destroy(GTK_COLOR_SELECTION_DIALOG(colorselectiondialog) |
gtk_widget_destroy (GTK_COLOR_SELECTION_DIALOG (colorselectiondialog)-> |
728 |
->help_button); |
help_button); |
729 |
|
|
730 |
themecolor = color_parse(preferences.themecolor); |
themecolor = color_parse (preferences.themecolor); |
731 |
gdk_color_parse(themecolor, &color); |
gdk_color_parse (themecolor, &color); |
732 |
g_free(themecolor); |
g_free (themecolor); |
733 |
rgb[0] = color.red / 65535.0; |
rgb[0] = color.red / 65535.0; |
734 |
rgb[1] = color.green / 65535.0; |
rgb[1] = color.green / 65535.0; |
735 |
rgb[2] = color.blue / 65535.0; |
rgb[2] = color.blue / 65535.0; |
736 |
gtk_color_selection_set_color(GTK_COLOR_SELECTION( |
gtk_color_selection_set_color (GTK_COLOR_SELECTION |
737 |
GTK_COLOR_SELECTION_DIALOG(colorselectiondialog)->colorsel), rgb); |
(GTK_COLOR_SELECTION_DIALOG |
738 |
|
(colorselectiondialog)->colorsel), rgb); |
739 |
|
|
740 |
gtk_widget_set_sensitive(preferencesdialog, 0); |
gtk_widget_set_sensitive (preferencesdialog, 0); |
741 |
gtk_widget_show(colorselectiondialog); |
gtk_widget_show (colorselectiondialog); |
742 |
} |
} |
743 |
|
|
744 |
/* change theme font */ |
/* change theme font */ |
745 |
void on_fontbutton_clicked(GtkButton *button, gpointer user_data) |
void |
746 |
|
on_fontbutton_clicked (GtkButton * button, gpointer user_data) |
747 |
{ |
{ |
748 |
GtkWidget *fontselectiondialog; |
GtkWidget *fontselectiondialog; |
749 |
|
|
750 |
fontselectiondialog = create_fontselectiondialog(); |
fontselectiondialog = create_fontselectiondialog (); |
751 |
gtk_widget_destroy(GTK_FONT_SELECTION_DIALOG(fontselectiondialog) |
gtk_widget_destroy (GTK_FONT_SELECTION_DIALOG (fontselectiondialog)-> |
752 |
->apply_button); |
apply_button); |
753 |
gtk_font_selection_dialog_set_preview_text(GTK_FONT_SELECTION_DIALOG |
gtk_font_selection_dialog_set_preview_text (GTK_FONT_SELECTION_DIALOG |
754 |
(fontselectiondialog), _("How about this font?")); |
(fontselectiondialog), |
755 |
gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG |
_("How about this font?")); |
756 |
(fontselectiondialog), preferences.themefont); |
gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG |
757 |
gtk_widget_set_sensitive(preferencesdialog, 0); |
(fontselectiondialog), |
758 |
gtk_widget_show(fontselectiondialog); |
preferences.themefont); |
759 |
|
gtk_widget_set_sensitive (preferencesdialog, 0); |
760 |
|
gtk_widget_show (fontselectiondialog); |
761 |
} |
} |
762 |
|
|
763 |
/* change path for the logs */ |
/* change path for the logs */ |
764 |
void on_pathbutton_clicked(GtkButton *button, gpointer user_data) |
void |
765 |
|
on_pathbutton_clicked (GtkButton * button, gpointer user_data) |
766 |
{ |
{ |
767 |
GtkWidget *pathselection; |
GtkWidget *pathselection; |
768 |
|
|
769 |
pathselection = create_pathselection(); |
pathselection = create_pathselection (); |
770 |
gtk_entry_set_editable(GTK_ENTRY(GTK_FILE_SELECTION(pathselection) |
gtk_entry_set_editable (GTK_ENTRY |
771 |
->selection_entry), FALSE); |
(GTK_FILE_SELECTION (pathselection)-> |
772 |
gtk_widget_set_sensitive(preferencesdialog, 0); |
selection_entry), FALSE); |
773 |
gtk_widget_show(pathselection); |
gtk_widget_set_sensitive (preferencesdialog, 0); |
774 |
|
gtk_widget_show (pathselection); |
775 |
} |
} |
776 |
|
|
777 |
|
|
778 |
/* SETUP DIALOG */ |
/* SETUP DIALOG */ |
779 |
void on_setupbutton_clicked (GtkButton *button, gpointer user_data) |
void |
780 |
|
on_setupbutton_clicked (GtkButton * button, gpointer user_data) |
781 |
{ |
{ |
782 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
783 |
gtk_widget_show(mainwindow); |
gtk_widget_show (mainwindow); |
784 |
gdk_window_move_resize(mainwindow->window, preferences.x, preferences.y, |
gdk_window_move_resize (mainwindow->window, preferences.x, preferences.y, |
785 |
preferences.width, preferences.height); |
preferences.width, preferences.height); |
786 |
} |
} |
787 |
|
|
788 |
/* setup dialog is deleted */ |
/* setup dialog is deleted */ |
789 |
gboolean on_setupdialog_delete_event(GtkWidget *widget, GdkEvent *event, |
gboolean |
790 |
gpointer user_data) |
on_setupdialog_delete_event (GtkWidget * widget, GdkEvent * event, |
791 |
{ |
gpointer user_data) |
792 |
gtk_widget_show(mainwindow); |
{ |
793 |
gdk_window_move_resize(mainwindow->window, preferences.x, preferences.y, |
gtk_widget_show (mainwindow); |
794 |
preferences.width, preferences.height); |
gdk_window_move_resize (mainwindow->window, preferences.x, preferences.y, |
795 |
return FALSE; |
preferences.width, preferences.height); |
796 |
|
return FALSE; |
797 |
} |
} |
798 |
|
|
799 |
/* SAVE DIALOG */ |
/* SAVE DIALOG */ |
800 |
void on_saveokbutton_clicked (GtkButton *button, gpointer user_data) |
void |
801 |
|
on_saveokbutton_clicked (GtkButton * button, gpointer user_data) |
802 |
{ |
{ |
803 |
gtk_exit(0); |
gtk_exit (0); |
804 |
} |
} |
805 |
|
|
806 |
/* cancel clicked, nothing saved */ |
/* cancel clicked, nothing saved */ |
807 |
void on_savecancelbutton_clicked (GtkButton *button, gpointer user_data) |
void |
808 |
|
on_savecancelbutton_clicked (GtkButton * button, gpointer user_data) |
809 |
{ |
{ |
810 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
811 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
812 |
} |
} |
813 |
|
|
814 |
/* save dialog is deleted */ |
/* save dialog is deleted */ |
815 |
gboolean on_savedialog_delete_event(GtkWidget *widget, GdkEvent *event, |
gboolean |
816 |
gpointer user_data) |
on_savedialog_delete_event (GtkWidget * widget, GdkEvent * event, |
817 |
|
gpointer user_data) |
818 |
{ |
{ |
819 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
820 |
return FALSE; |
return FALSE; |
821 |
} |
} |
822 |
|
|
823 |
/* PRINT DIALOG */ |
/* PRINT DIALOG */ |
824 |
void on_printokbutton_clicked (GtkButton *button, gpointer user_data) |
void |
825 |
|
on_printokbutton_clicked (GtkButton * button, gpointer user_data) |
826 |
{ |
{ |
827 |
GtkWidget *printallradiobutton, *printrangeradiobutton, *printlowentry, |
GtkWidget *printallradiobutton, *printrangeradiobutton, *printlowentry, |
828 |
*printhighentry, *sizecomboentry, *pointcomboentry, *conteststyleradiobutton, |
*printhighentry, *sizecomboentry, *pointcomboentry, |
829 |
*normalstyleradiobutton, *filedestinationradiobutton, |
*conteststyleradiobutton, *normalstyleradiobutton, |
830 |
*printerdestinationradiobutton, *endhbox, *qslhbox, *powerhbox, *namehbox, |
*filedestinationradiobutton, *printerdestinationradiobutton, *endhbox, |
831 |
*qthhbox, *locatorhbox, *unknown1hbox, *unknown2hbox, *remarksvbox; |
*qslhbox, *powerhbox, *namehbox, *qthhbox, *locatorhbox, *unknown1hbox, |
832 |
gchar *temp, *texpoint, *texorientation, *texsize, *texfile, |
*unknown2hbox, *remarksvbox; |
833 |
*printstring = NULL, **item; |
gchar *temp, *texpoint, *texorientation, *texsize, *texfile, *printstring = |
834 |
FILE *fp; |
NULL, **item; |
835 |
gint i, j, k = 0, printhigh, printlow; |
FILE *fp; |
836 |
gboolean printok = FALSE; |
gint i, j, k = 0, printhigh, printlow; |
837 |
logtype *logwindow; |
gboolean printok = FALSE; |
838 |
|
logtype *logwindow; |
839 |
printallradiobutton = lookup_widget(printdialog, "printallradiobutton"); |
|
840 |
printrangeradiobutton = lookup_widget(printdialog, "printrangeradiobutton"); |
printallradiobutton = lookup_widget (printdialog, "printallradiobutton"); |
841 |
printlowentry = lookup_widget(printdialog, "printlowentry"); |
printrangeradiobutton = |
842 |
printhighentry = lookup_widget(printdialog, "printhighentry"); |
lookup_widget (printdialog, "printrangeradiobutton"); |
843 |
sizecomboentry = lookup_widget(printdialog, "sizecomboentry"); |
printlowentry = lookup_widget (printdialog, "printlowentry"); |
844 |
pointcomboentry = lookup_widget(printdialog, "pointcomboentry"); |
printhighentry = lookup_widget (printdialog, "printhighentry"); |
845 |
filedestinationradiobutton = lookup_widget(printdialog, |
sizecomboentry = lookup_widget (printdialog, "sizecomboentry"); |
846 |
"filedestinationradiobutton"); |
pointcomboentry = lookup_widget (printdialog, "pointcomboentry"); |
847 |
printerdestinationradiobutton = lookup_widget(printdialog, |
filedestinationradiobutton = lookup_widget (printdialog, |
848 |
"printerdestinationradiobutton"); |
"filedestinationradiobutton"); |
849 |
normalstyleradiobutton = lookup_widget(printdialog, "normalstyleradiobutton"); |
printerdestinationradiobutton = lookup_widget (printdialog, |
850 |
conteststyleradiobutton = lookup_widget(printdialog, "conteststyleradiobutton"); |
"printerdestinationradiobutton"); |
851 |
|
normalstyleradiobutton = |
852 |
/* save settings of the print dialog */ |
lookup_widget (printdialog, "normalstyleradiobutton"); |
853 |
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(printallradiobutton))) |
conteststyleradiobutton = |
854 |
preferences.printall = 0; |
lookup_widget (printdialog, "conteststyleradiobutton"); |
855 |
else |
|
856 |
preferences.printall = 1; |
/* save settings of the print dialog */ |
857 |
temp = gtk_editable_get_chars(GTK_EDITABLE(printlowentry), 0, -1); |
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (printallradiobutton))) |
858 |
printlow = atoi(temp); |
preferences.printall = 0; |
859 |
temp = gtk_editable_get_chars(GTK_EDITABLE(printhighentry), 0, -1); |
else |
860 |
printhigh = atoi(temp); |
preferences.printall = 1; |
861 |
temp = gtk_editable_get_chars(GTK_EDITABLE(sizecomboentry), 0, -1); |
temp = gtk_editable_get_chars (GTK_EDITABLE (printlowentry), 0, -1); |
862 |
if (g_strcasecmp(temp, "a4") == 0) preferences.printsize = 0; |
printlow = atoi (temp); |
863 |
else preferences.printsize = 1; |
temp = gtk_editable_get_chars (GTK_EDITABLE (printhighentry), 0, -1); |
864 |
temp = gtk_editable_get_chars(GTK_EDITABLE(pointcomboentry), 0, -1); |
printhigh = atoi (temp); |
865 |
if (g_strcasecmp(temp, "10") == 0) preferences.printpoint = 0; |
temp = gtk_editable_get_chars (GTK_EDITABLE (sizecomboentry), 0, -1); |
866 |
else if (g_strcasecmp(temp, "11") == 0) preferences.printpoint = 1; |
if (g_strcasecmp (temp, "a4") == 0) |
867 |
else if (g_strcasecmp(temp, "12") == 0) preferences.printpoint = 2; |
preferences.printsize = 0; |
868 |
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(printerdestinationradiobutton))) |
else |
869 |
preferences.printdestination = 0; |
preferences.printsize = 1; |
870 |
else |
temp = gtk_editable_get_chars (GTK_EDITABLE (pointcomboentry), 0, -1); |
871 |
preferences.printdestination = 1; |
if (g_strcasecmp (temp, "10") == 0) |
872 |
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(normalstyleradiobutton))) |
preferences.printpoint = 0; |
873 |
preferences.printstyle = 0; |
else if (g_strcasecmp (temp, "11") == 0) |
874 |
else |
preferences.printpoint = 1; |
875 |
preferences.printstyle = 1; |
else if (g_strcasecmp (temp, "12") == 0) |
876 |
|
preferences.printpoint = 2; |
877 |
/* tex strings that may differ */ |
if (gtk_toggle_button_get_active |
878 |
if (preferences.printsize == 0) texsize = g_strdup("a4paper"); |
(GTK_TOGGLE_BUTTON (printerdestinationradiobutton))) |
879 |
else texsize = g_strdup("letterpaper"); |
preferences.printdestination = 0; |
880 |
if (preferences.printstyle == 0) texorientation = g_strdup("landscape"); |
else |
881 |
else texorientation = g_strdup("portrait"); |
preferences.printdestination = 1; |
882 |
if (preferences.printpoint == 0) texpoint = g_strdup("10pt"); |
if (gtk_toggle_button_get_active |
883 |
else if (preferences.printpoint == 1) texpoint = g_strdup("11pt"); |
(GTK_TOGGLE_BUTTON (normalstyleradiobutton))) |
884 |
else texpoint = g_strdup("12pt"); |
preferences.printstyle = 0; |
885 |
|
else |
886 |
logwindow = g_list_nth_data(logwindowlist, |
preferences.printstyle = 1; |
887 |
gtk_notebook_get_current_page(GTK_NOTEBOOK(mainnotebook))); |
|
888 |
gtk_clist_freeze(GTK_CLIST(logwindow->clist)); |
/* tex strings that may differ */ |
889 |
|
if (preferences.printsize == 0) |
890 |
item = g_new0(gchar *, QSO_FIELDS); |
texsize = g_strdup ("a4paper"); |
891 |
texfile = g_strconcat(xlogdir, G_DIR_SEPARATOR_S, "log.tex", NULL); |
else |
892 |
fp = fopen(texfile, "w"); |
texsize = g_strdup ("letterpaper"); |
893 |
if (fp) |
if (preferences.printstyle == 0) |
894 |
{ /* widgets which may be visible */ |
texorientation = g_strdup ("landscape"); |
895 |
endhbox = lookup_widget(mainwindow, "endhbox"); |
else |
896 |
qslhbox = lookup_widget(mainwindow, "qslhbox"); |
texorientation = g_strdup ("portrait"); |
897 |
powerhbox = lookup_widget(mainwindow, "powerhbox"); |
if (preferences.printpoint == 0) |
898 |
namehbox = lookup_widget(mainwindow, "namehbox"); |
texpoint = g_strdup ("10pt"); |
899 |
qthhbox = lookup_widget(mainwindow, "qthhbox"); |
else if (preferences.printpoint == 1) |
900 |
locatorhbox = lookup_widget(mainwindow, "locatorhbox"); |
texpoint = g_strdup ("11pt"); |
901 |
unknown1hbox = lookup_widget(mainwindow, "unknown1hbox"); |
else |
902 |
unknown2hbox = lookup_widget(mainwindow, "unknown2hbox"); |
texpoint = g_strdup ("12pt"); |
903 |
remarksvbox = lookup_widget(mainwindow, "remarksvbox"); |
|
904 |
|
logwindow = g_list_nth_data (logwindowlist, |
905 |
fprintf(fp, "\\documentclass[%s,%s,%s]{article}\n", texsize, texorientation, texpoint); |
gtk_notebook_get_current_page (GTK_NOTEBOOK |
906 |
fprintf(fp, "\\pagestyle{empty}\n"); |
(mainnotebook))); |
907 |
fprintf(fp, "\\usepackage[%s,left=15mm,right=15mm,top=10mm,bottom=10mm]{geometry}\n", texsize); |
gtk_clist_freeze (GTK_CLIST (logwindow->clist)); |
908 |
fprintf(fp, "\\begin{document}\n"); |
|
909 |
if (preferences.printstyle == 0) |
item = g_new0 (gchar *, QSO_FIELDS); |
910 |
{ |
texfile = g_strconcat (xlogdir, G_DIR_SEPARATOR_S, "log.tex", NULL); |
911 |
fprintf(fp, "\\begin{tabular}{||l|l|l"); /* nr, date, gmt */ |
fp = fopen (texfile, "w"); |
912 |
if (GTK_WIDGET_VISIBLE(endhbox)) fprintf(fp, "|l"); /* gmtend */ |
if (fp) |
913 |
fprintf(fp, "|l|l|l|l|l"); /* call band mode rst myrst */ |
{ /* widgets which may be visible */ |
914 |
if (GTK_WIDGET_VISIBLE(qslhbox)) fprintf(fp, "|c|c"); /* qslin, qslout */ |
endhbox = lookup_widget (mainwindow, "endhbox"); |
915 |
if (GTK_WIDGET_VISIBLE(powerhbox)) fprintf(fp, "|l"); /* power */ |
qslhbox = lookup_widget (mainwindow, "qslhbox"); |
916 |
if (GTK_WIDGET_VISIBLE(namehbox)) fprintf(fp, "|l"); /* name */ |
powerhbox = lookup_widget (mainwindow, "powerhbox"); |
917 |
if (GTK_WIDGET_VISIBLE(qthhbox)) fprintf(fp, "|l"); /* qth */ |
namehbox = lookup_widget (mainwindow, "namehbox"); |
918 |
if (GTK_WIDGET_VISIBLE(locatorhbox)) fprintf(fp, "|l"); /* locator */ |
qthhbox = lookup_widget (mainwindow, "qthhbox"); |
919 |
if (GTK_WIDGET_VISIBLE(unknown1hbox)) fprintf(fp, "|l"); /* unknown1 */ |
locatorhbox = lookup_widget (mainwindow, "locatorhbox"); |
920 |
if (GTK_WIDGET_VISIBLE(unknown2hbox)) fprintf(fp, "|l"); /* unknown2 */ |
unknown1hbox = lookup_widget (mainwindow, "unknown1hbox"); |
921 |
if (GTK_WIDGET_VISIBLE(remarksvbox))fprintf(fp, "|l"); /*remarks */ |
unknown2hbox = lookup_widget (mainwindow, "unknown2hbox"); |
922 |
fprintf(fp, "||}\n"); |
remarksvbox = lookup_widget (mainwindow, "remarksvbox"); |
923 |
} |
|
924 |
else |
fprintf (fp, "\\documentclass[%s,%s,%s]{article}\n", texsize, |
925 |
fprintf(fp, "\\begin{tabular}{||l|l|l|l|l|l|l|l||l|l||}\n"); |
texorientation, texpoint); |
926 |
fprintf(fp, "\\hline\n"); |
fprintf (fp, "\\pagestyle{empty}\n"); |
927 |
if (preferences.printstyle == 0) |
fprintf (fp, |
928 |
{ |
"\\usepackage[%s,left=15mm,right=15mm,top=10mm,bottom=10mm]{geometry}\n", |
929 |
fprintf(fp, "\\textbf{Nr} &\\textbf{Date} &\\textbf{GMT}"); |
texsize); |
930 |
if (GTK_WIDGET_VISIBLE(endhbox)) fprintf(fp, "&\\textbf{END}"); |
fprintf (fp, "\\begin{document}\n"); |
931 |
fprintf(fp, "&\\textbf{Callsign} &\\textbf{MHz} &\\textbf{Mode} &\\textbf{TX} &\\textbf{RX}"); |
if (preferences.printstyle == 0) |
932 |
if (GTK_WIDGET_VISIBLE(qslhbox)) fprintf(fp, "&\\textbf{Out} &\\textbf{In}"); |
{ |
933 |
if (GTK_WIDGET_VISIBLE(powerhbox)) fprintf(fp, "&\\textbf{Pwr}"); |
fprintf (fp, "\\begin{tabular}{||l|l|l"); /* nr, date, gmt */ |
934 |
if (GTK_WIDGET_VISIBLE(namehbox)) fprintf(fp, "&\\textbf{Name}"); |
if (GTK_WIDGET_VISIBLE (endhbox)) |
935 |
if (GTK_WIDGET_VISIBLE(qthhbox)) fprintf(fp, "&\\textbf{QTH}"); |
fprintf (fp, "|l"); /* gmtend */ |
936 |
if (GTK_WIDGET_VISIBLE(locatorhbox)) fprintf(fp, "&\\textbf{Locator}"); |
fprintf (fp, "|l|l|l|l|l"); /* call band mode rst myrst */ |
937 |
if (GTK_WIDGET_VISIBLE(unknown1hbox)) |
if (GTK_WIDGET_VISIBLE (qslhbox)) |
938 |
{ |
fprintf (fp, "|c|c"); /* qslin, qslout */ |
939 |
fprintf(fp, "&\\textbf{"); |
if (GTK_WIDGET_VISIBLE (powerhbox)) |
940 |
fprintf(fp, preferences.freefield1); |
fprintf (fp, "|l"); /* power */ |
941 |
fprintf(fp, "}"); |
if (GTK_WIDGET_VISIBLE (namehbox)) |
942 |
} |
fprintf (fp, "|l"); /* name */ |
943 |
if (GTK_WIDGET_VISIBLE(unknown2hbox)) |
if (GTK_WIDGET_VISIBLE (qthhbox)) |
944 |
{ |
fprintf (fp, "|l"); /* qth */ |
945 |
fprintf(fp, "&\\textbf{"); |
if (GTK_WIDGET_VISIBLE (locatorhbox)) |
946 |
fprintf(fp, preferences.freefield2); |
fprintf (fp, "|l"); /* locator */ |
947 |
fprintf(fp, "}"); |
if (GTK_WIDGET_VISIBLE (unknown1hbox)) |
948 |
} |
fprintf (fp, "|l"); /* unknown1 */ |
949 |
if (GTK_WIDGET_VISIBLE(remarksvbox)) fprintf(fp, "&\\textbf{Remarks}"); |
if (GTK_WIDGET_VISIBLE (unknown2hbox)) |
950 |
fprintf(fp, "\\\\\n"); |
fprintf (fp, "|l"); /* unknown2 */ |
951 |
} |
if (GTK_WIDGET_VISIBLE (remarksvbox)) |
952 |
else |
fprintf (fp, "|l"); /*remarks */ |
953 |
fprintf(fp, "\\textbf{Nr} &\\textbf{Date} &\\textbf{GMT} &\\textbf{Callsign} &\\textbf{MHz} &\\textbf{Mode} &\\textbf{TX} &\\textbf{RX} &\\textbf{Multiplier} &\\textbf{Points}\\\\\n"); |
fprintf (fp, "||}\n"); |
954 |
fprintf(fp, "\\hline\n"); |
} |
955 |
fprintf(fp, "\\hline\n"); |
else |
956 |
|
fprintf (fp, "\\begin{tabular}{||l|l|l|l|l|l|l|l||l|l||}\n"); |
957 |
|
fprintf (fp, "\\hline\n"); |
958 |
|
if (preferences.printstyle == 0) |
959 |
|
{ |
960 |
|
fprintf (fp, "\\textbf{Nr} &\\textbf{Date} &\\textbf{GMT}"); |
961 |
|
if (GTK_WIDGET_VISIBLE (endhbox)) |
962 |
|
fprintf (fp, "&\\textbf{END}"); |
963 |
|
fprintf (fp, |
964 |
|
"&\\textbf{Callsign} &\\textbf{MHz} &\\textbf{Mode} &\\textbf{TX} &\\textbf{RX}"); |
965 |
|
if (GTK_WIDGET_VISIBLE (qslhbox)) |
966 |
|
fprintf (fp, "&\\textbf{Out} &\\textbf{In}"); |
967 |
|
if (GTK_WIDGET_VISIBLE (powerhbox)) |
968 |
|
fprintf (fp, "&\\textbf{Pwr}"); |
969 |
|
if (GTK_WIDGET_VISIBLE (namehbox)) |
970 |
|
fprintf (fp, "&\\textbf{Name}"); |
971 |
|
if (GTK_WIDGET_VISIBLE (qthhbox)) |
972 |
|
fprintf (fp, "&\\textbf{QTH}"); |
973 |
|
if (GTK_WIDGET_VISIBLE (locatorhbox)) |
974 |
|
fprintf (fp, "&\\textbf{Locator}"); |
975 |
|
if (GTK_WIDGET_VISIBLE (unknown1hbox)) |
976 |
|
{ |
977 |
|
fprintf (fp, "&\\textbf{"); |
978 |
|
fprintf (fp, preferences.freefield1); |
979 |
|
fprintf (fp, "}"); |
980 |
|
} |
981 |
|
if (GTK_WIDGET_VISIBLE (unknown2hbox)) |
982 |
|
{ |
983 |
|
fprintf (fp, "&\\textbf{"); |
984 |
|
fprintf (fp, preferences.freefield2); |
985 |
|
fprintf (fp, "}"); |
986 |
|
} |
987 |
|
if (GTK_WIDGET_VISIBLE (remarksvbox)) |
988 |
|
fprintf (fp, "&\\textbf{Remarks}"); |
989 |
|
fprintf (fp, "\\\\\n"); |
990 |
|
} |
991 |
|
else |
992 |
|
fprintf (fp, |
993 |
|
"\\textbf{Nr} &\\textbf{Date} &\\textbf{GMT} &\\textbf{Callsign} &\\textbf{MHz} &\\textbf{Mode} &\\textbf{TX} &\\textbf{RX} &\\textbf{Multiplier} &\\textbf{Points}\\\\\n"); |
994 |
|
fprintf (fp, "\\hline\n"); |
995 |
|
fprintf (fp, "\\hline\n"); |
996 |
|
|
997 |
if (preferences.printall == 0) |
if (preferences.printall == 0) |
998 |
{ |
{ |
999 |
printlow = 1; |
printlow = 1; |
1000 |
printhigh = logwindow->qsos; |
printhigh = logwindow->qsos; |
1001 |
} |
} |
1002 |
|
|
1003 |
if (GTK_CLIST(logwindow->clist)->rows > 0) |
if (GTK_CLIST (logwindow->clist)->rows > 0) |
1004 |
{ |
{ |
1005 |
for(i = GTK_CLIST(logwindow->clist)->rows - printlow; |
for (i = GTK_CLIST (logwindow->clist)->rows - printlow; |
1006 |
i >= GTK_CLIST(logwindow->clist)->rows - printhigh; i--) |
i >= GTK_CLIST (logwindow->clist)->rows - printhigh; i--) |
1007 |
{ |
{ |
1008 |
for (j = 0; j < QSO_FIELDS; j++) |
for (j = 0; j < QSO_FIELDS; j++) |
1009 |
gtk_clist_get_text(GTK_CLIST(logwindow->clist), i, j, &item[j]); |
gtk_clist_get_text (GTK_CLIST (logwindow->clist), i, j, |
1010 |
if (preferences.printstyle == 0) |
&item[j]); |
1011 |
{ |
if (preferences.printstyle == 0) |
1012 |
fprintf(fp, "%s&%s&%s", item[NR], item[DATE], item[GMT]); |
{ |
1013 |
if (GTK_WIDGET_VISIBLE(endhbox)) fprintf(fp, "&%s", item[GMTEND]); |
fprintf (fp, "%s&%s&%s", item[NR], item[DATE], item[GMT]); |
1014 |
fprintf(fp, "&\\textbf{%s}&%s&%s&%s&%s", |
if (GTK_WIDGET_VISIBLE (endhbox)) |
1015 |
item[CALL], item[BAND], item[MODE], item[RST], item[MYRST]); |
fprintf (fp, "&%s", item[GMTEND]); |
1016 |
if (GTK_WIDGET_VISIBLE(qslhbox)) fprintf(fp, "&%s&%s", item[QSLOUT], item[QSLIN]); |
fprintf (fp, "&\\textbf{%s}&%s&%s&%s&%s", |
1017 |
if (GTK_WIDGET_VISIBLE(powerhbox)) fprintf(fp, "&%s", item[POWER]); |
item[CALL], item[BAND], item[MODE], item[RST], |
1018 |
if (GTK_WIDGET_VISIBLE(namehbox)) fprintf(fp, "&%s", item[NAME]); |
item[MYRST]); |
1019 |
if (GTK_WIDGET_VISIBLE(qthhbox)) fprintf(fp, "&%s", item[QTH]); |
if (GTK_WIDGET_VISIBLE (qslhbox)) |
1020 |
if (GTK_WIDGET_VISIBLE(locatorhbox)) fprintf(fp, "&%s", item[LOCATOR]); |
fprintf (fp, "&%s&%s", item[QSLOUT], item[QSLIN]); |
1021 |
if (GTK_WIDGET_VISIBLE(unknown1hbox)) fprintf(fp, "&%s", item[U1]); |
if (GTK_WIDGET_VISIBLE (powerhbox)) |
1022 |
if (GTK_WIDGET_VISIBLE(unknown2hbox)) fprintf(fp, "&%s", item[U2]); |
fprintf (fp, "&%s", item[POWER]); |
1023 |
if (GTK_WIDGET_VISIBLE(remarksvbox)) |
if (GTK_WIDGET_VISIBLE (namehbox)) |
1024 |
{ /* escape # for latex, TODO: &, _, %, $, \, {, }, ^ */ |
fprintf (fp, "&%s", item[NAME]); |
1025 |
if (strstr(item[REMARKS], "#")) |
if (GTK_WIDGET_VISIBLE (qthhbox)) |
1026 |
temp = strreplace(item[REMARKS], "#", "\\#"); |
fprintf (fp, "&%s", item[QTH]); |
1027 |
fprintf(fp,"&%s", temp); |
if (GTK_WIDGET_VISIBLE (locatorhbox)) |
1028 |
} |
fprintf (fp, "&%s", item[LOCATOR]); |
1029 |
fprintf(fp, "\\\\\n"); |
if (GTK_WIDGET_VISIBLE (unknown1hbox)) |
1030 |
} |
fprintf (fp, "&%s", item[U1]); |
1031 |
else |
if (GTK_WIDGET_VISIBLE (unknown2hbox)) |
1032 |
fprintf(fp, "%d&%s&%s&\\textbf{%s}&%s&%s&%s&%s&~&~\\\\\n", |
fprintf (fp, "&%s", item[U2]); |
1033 |
k+1, item[DATE], item[GMT], item[CALL], item[BAND], item[MODE], item[RST], item[MYRST]); |
if (GTK_WIDGET_VISIBLE (remarksvbox)) |
1034 |
k++; |
{ /* escape # for latex, TODO: &, _, %, $, \, {, }, ^ */ |
1035 |
if ((k % 30 == 0 && preferences.printstyle == 0 && k != printhigh - printlow + 1) || |
if (strstr (item[REMARKS], "#")) |
1036 |
(k % 50 == 0 && preferences.printstyle == 1 && k != printhigh - printlow + 1)) { |
temp = strreplace (item[REMARKS], "#", "\\#"); |
1037 |
fprintf(fp, "\\hline\n"); |
fprintf (fp, "&%s", temp); |
1038 |
fprintf(fp, "\\end{tabular}\n"); |
} |
1039 |
fprintf(fp, "\\begin{center}\n"); |
fprintf (fp, "\\\\\n"); |
1040 |
fprintf(fp, "\\emph{Printed by xlog version %s}\n", VERSION); |
} |
1041 |
fprintf(fp, "\\end{center}\n"); |
else |
1042 |
fprintf(fp, "\\newpage\n"); |
fprintf (fp, "%d&%s&%s&\\textbf{%s}&%s&%s&%s&%s&~&~\\\\\n", |
1043 |
if (preferences.printstyle == 0) |
k + 1, item[DATE], item[GMT], item[CALL], item[BAND], |
1044 |
fprintf(fp, "\\begin{tabular}{||l|l|l|l|l|l|l|l||l|c|c||}\n"); |
item[MODE], item[RST], item[MYRST]); |
1045 |
else |
k++; |
1046 |
fprintf(fp, "\\begin{tabular}{||l|l|l|l|l|l|l|l||l|l||}\n"); |
if ((k % 30 == 0 && preferences.printstyle == 0 |
1047 |
fprintf(fp, "\\hline\n"); |
&& k != printhigh - printlow + 1) || (k % 50 == 0 |
1048 |
if (preferences.printstyle == 0) |
&& preferences. |
1049 |
{ |
printstyle == 1 |
1050 |
fprintf(fp, "\\textbf{Nr} &\\textbf{Date} &\\textbf{GMT}"); |
&& k != |
1051 |
if (GTK_WIDGET_VISIBLE(endhbox)) fprintf(fp, "&\\textbf{END}"); |
printhigh - |
1052 |
fprintf(fp, "&\\textbf{Callsign} &\\textbf{MHz} &\\textbf{Mode} &\\textbf{TX} &\\textbf{RX}"); |
printlow + 1)) |
1053 |
if (GTK_WIDGET_VISIBLE(qslhbox)) fprintf(fp, "&\\textbf{Out} &\\textbf{In} "); |
{ |
1054 |
if (GTK_WIDGET_VISIBLE(powerhbox)) fprintf(fp, "&\\textbf{Pwr}"); |
fprintf (fp, "\\hline\n"); |
1055 |
if (GTK_WIDGET_VISIBLE(namehbox)) fprintf(fp, "&\\textbf{Name}"); |
fprintf (fp, "\\end{tabular}\n"); |
1056 |
if (GTK_WIDGET_VISIBLE(qthhbox)) fprintf(fp, "&\\textbf{QTH}"); |
fprintf (fp, "\\begin{center}\n"); |
1057 |
if (GTK_WIDGET_VISIBLE(locatorhbox)) fprintf(fp, "&\\textbf{Locator}"); |
fprintf (fp, "\\emph{Printed by xlog version %s}\n", |
1058 |
if (GTK_WIDGET_VISIBLE(unknown1hbox)) |
VERSION); |
1059 |
{ |
fprintf (fp, "\\end{center}\n"); |
1060 |
fprintf(fp, "&\\textbf{"); |
fprintf (fp, "\\newpage\n"); |
1061 |
fprintf(fp, preferences.freefield1); |
if (preferences.printstyle == 0) |
1062 |
fprintf(fp, "}"); |
fprintf (fp, |
1063 |
} |
"\\begin{tabular}{||l|l|l|l|l|l|l|l||l|c|c||}\n"); |
1064 |
if (GTK_WIDGET_VISIBLE(unknown2hbox)) |
else |
1065 |
{ |
fprintf (fp, |
1066 |
fprintf(fp, "&\\textbf{"); |
"\\begin{tabular}{||l|l|l|l|l|l|l|l||l|l||}\n"); |
1067 |
fprintf(fp, preferences.freefield2); |
fprintf (fp, "\\hline\n"); |
1068 |
fprintf(fp, "}"); |
if (preferences.printstyle == 0) |
1069 |
} |
{ |
1070 |
if (GTK_WIDGET_VISIBLE(remarksvbox)) fprintf(fp, "&\\textbf{Remarks}"); |
fprintf (fp, |
1071 |
fprintf(fp, "\\\\\n"); |
"\\textbf{Nr} &\\textbf{Date} &\\textbf{GMT}"); |
1072 |
} |
if (GTK_WIDGET_VISIBLE (endhbox)) |
1073 |
else |
fprintf (fp, "&\\textbf{END}"); |
1074 |
fprintf(fp, "\\textbf{Nr} &\\textbf{Date} &\\textbf{GMT} &\\textbf{Callsign} &\\textbf{MHz} &\\textbf{Mode} &\\textbf{TX} &\\textbf{RX} &\\textbf{Multiplier} &\\textbf{Points}\\\\\n"); |
fprintf (fp, |
1075 |
fprintf(fp, "\\hline\n"); |
"&\\textbf{Callsign} &\\textbf{MHz} &\\textbf{Mode} &\\textbf{TX} &\\textbf{RX}"); |
1076 |
fprintf(fp, "\\hline\n"); |
if (GTK_WIDGET_VISIBLE (qslhbox)) |
1077 |
} |
fprintf (fp, "&\\textbf{Out} &\\textbf{In} "); |
1078 |
} |
if (GTK_WIDGET_VISIBLE (powerhbox)) |
1079 |
|
fprintf (fp, "&\\textbf{Pwr}"); |
1080 |
|
if (GTK_WIDGET_VISIBLE (namehbox)) |
1081 |
|
fprintf (fp, "&\\textbf{Name}"); |
1082 |
|
if (GTK_WIDGET_VISIBLE (qthhbox)) |
1083 |
|
fprintf (fp, "&\\textbf{QTH}"); |
1084 |
|
if (GTK_WIDGET_VISIBLE (locatorhbox)) |
1085 |
|
fprintf (fp, "&\\textbf{Locator}"); |
1086 |
|
if (GTK_WIDGET_VISIBLE (unknown1hbox)) |
1087 |
|
{ |
1088 |
|
fprintf (fp, "&\\textbf{"); |
1089 |
|
fprintf (fp, preferences.freefield1); |
1090 |
|
fprintf (fp, "}"); |
1091 |
|
} |
1092 |
|
if (GTK_WIDGET_VISIBLE (unknown2hbox)) |
1093 |
|
{ |
1094 |
|
fprintf (fp, "&\\textbf{"); |
1095 |
|
fprintf (fp, preferences.freefield2); |
1096 |
|
fprintf (fp, "}"); |
1097 |
|
} |
1098 |
|
if (GTK_WIDGET_VISIBLE (remarksvbox)) |
1099 |
|
fprintf (fp, "&\\textbf{Remarks}"); |
1100 |
|
fprintf (fp, "\\\\\n"); |
1101 |
|
} |
1102 |
|
else |
1103 |
|
fprintf (fp, |
1104 |
|
"\\textbf{Nr} &\\textbf{Date} &\\textbf{GMT} &\\textbf{Callsign} &\\textbf{MHz} &\\textbf{Mode} &\\textbf{TX} &\\textbf{RX} &\\textbf{Multiplier} &\\textbf{Points}\\\\\n"); |
1105 |
|
fprintf (fp, "\\hline\n"); |
1106 |
|
fprintf (fp, "\\hline\n"); |
1107 |
} |
} |
1108 |
|
} |
1109 |
|
} |
1110 |
|
|
1111 |
fprintf(fp, "\\hline\n"); |
fprintf (fp, "\\hline\n"); |
1112 |
fprintf(fp, "\\end{tabular}\n"); |
fprintf (fp, "\\end{tabular}\n"); |
1113 |
fprintf(fp, "\\begin{center}\n"); |
fprintf (fp, "\\begin{center}\n"); |
1114 |
fprintf(fp, "\\emph{Printed by xlog version %s}\n", VERSION); |
fprintf (fp, "\\emph{Printed by xlog version %s}\n", VERSION); |
1115 |
fprintf(fp, "\\end{center}\n"); |
fprintf (fp, "\\end{center}\n"); |
1116 |
fprintf(fp, "\\end{document}\n"); |
fprintf (fp, "\\end{document}\n"); |
1117 |
fclose(fp); |
fclose (fp); |
1118 |
} |
} |
1119 |
|
|
1120 |
gtk_clist_thaw(GTK_CLIST(logwindow->clist)); |
gtk_clist_thaw (GTK_CLIST (logwindow->clist)); |
1121 |
g_free(item); |
g_free (item); |
1122 |
|
|
1123 |
if ((printok = latexavailable()) == FALSE) { |
if ((printok = latexavailable ()) == FALSE) |
1124 |
update_statusbar(_("Latex is not available, install the tetex package")); |
{ |
1125 |
} |
update_statusbar (_ |
1126 |
|
("Latex is not available, install the tetex package")); |
1127 |
if (printok) |
} |
1128 |
{ |
|
1129 |
if (preferences.printdestination == 0 && preferences.printstyle == 0) |
if (printok) |
1130 |
printstring = g_strdup_printf("cd %s; latex -interaction=nonstopmode log.tex; dvips -t landscape log.dvi", xlogdir); |
{ |
1131 |
else if (preferences.printdestination == 1 && preferences.printstyle == 0) |
if (preferences.printdestination == 0 && preferences.printstyle == 0) |
1132 |
printstring = g_strdup_printf("cd %s; latex -interaction=nonstopmode log.tex; dvips -t landscape -o log.ps log.dvi", xlogdir); |
printstring = |
1133 |
else if (preferences.printdestination == 0 && preferences.printstyle == 1) |
g_strdup_printf |
1134 |
printstring = g_strdup_printf("cd %s; latex -interaction=nonstopmode log.tex; dvips log.dvi", xlogdir); |
("cd %s; latex -interaction=nonstopmode log.tex; dvips -t landscape log.dvi", |
1135 |
else if (preferences.printdestination == 1 && preferences.printstyle == 1) |
xlogdir); |
1136 |
printstring = g_strdup_printf("cd %s; -interaction=nonstopmode latex log.tex; dvips -o log.ps log.dvi", xlogdir); |
else if (preferences.printdestination == 1 |
1137 |
if (preferences.printdestination == 0) |
&& preferences.printstyle == 0) |
1138 |
temp = g_strdup_printf(_("Log send to printer")); |
printstring = |
1139 |
else |
g_strdup_printf |
1140 |
temp = g_strdup_printf(_("Log printed to %s%slog.ps"), G_DIR_SEPARATOR_S, xlogdir); |
("cd %s; latex -interaction=nonstopmode log.tex; dvips -t landscape -o log.ps log.dvi", |
1141 |
system(printstring); |
xlogdir); |
1142 |
update_statusbar(temp); |
else if (preferences.printdestination == 0 |
1143 |
g_free(printstring); |
&& preferences.printstyle == 1) |
1144 |
} |
printstring = |
1145 |
|
g_strdup_printf |
1146 |
g_free(texsize); |
("cd %s; latex -interaction=nonstopmode log.tex; dvips log.dvi", |
1147 |
g_free(texorientation); |
xlogdir); |
1148 |
g_free(texpoint); |
else if (preferences.printdestination == 1 |
1149 |
g_free(texfile); |
&& preferences.printstyle == 1) |
1150 |
g_free(temp); |
printstring = |
1151 |
|
g_strdup_printf |
1152 |
|
("cd %s; -interaction=nonstopmode latex log.tex; dvips -o log.ps log.dvi", |
1153 |
|
xlogdir); |
1154 |
|
if (preferences.printdestination == 0) |
1155 |
|
temp = g_strdup_printf (_("Log send to printer")); |
1156 |
|
else |
1157 |
|
temp = |
1158 |
|
g_strdup_printf (_("Log printed to %s%slog.ps"), G_DIR_SEPARATOR_S, |
1159 |
|
xlogdir); |
1160 |
|
system (printstring); |
1161 |
|
update_statusbar (temp); |
1162 |
|
g_free (printstring); |
1163 |
|
} |
1164 |
|
|
1165 |
|
g_free (texsize); |
1166 |
|
g_free (texorientation); |
1167 |
|
g_free (texpoint); |
1168 |
|
g_free (texfile); |
1169 |
|
g_free (temp); |
1170 |
|
|
1171 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1172 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
1173 |
} |
} |
1174 |
|
|
1175 |
/* cancel clicked, nothing printed */ |
/* cancel clicked, nothing printed */ |
1176 |
void on_printcancelbutton_clicked (GtkButton *button, gpointer user_data) |
void |
1177 |
|
on_printcancelbutton_clicked (GtkButton * button, gpointer user_data) |
1178 |
{ |
{ |
1179 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1180 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
1181 |
} |
} |
1182 |
|
|
1183 |
/* print dialog is deleted */ |
/* print dialog is deleted */ |
1184 |
gboolean on_printdialog_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) |
gboolean |
1185 |
|
on_printdialog_delete_event (GtkWidget * widget, GdkEvent * event, |
1186 |
|
gpointer user_data) |
1187 |
{ |
{ |
1188 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1189 |
return FALSE; |
return FALSE; |
1190 |
} |
} |
1191 |
|
|
1192 |
/* set sensitivity of range widgets in print dialog */ |
/* set sensitivity of range widgets in print dialog */ |
1193 |
void on_printradiobutton_toggled (GtkToggleButton *togglebutton, gpointer user_data) |
void |
1194 |
{ |
on_printradiobutton_toggled (GtkToggleButton * togglebutton, |
1195 |
GtkWidget *printlowentry, *printrangelabel, *printhighentry; |
gpointer user_data) |
1196 |
|
{ |
1197 |
printlowentry = lookup_widget(printdialog, "printlowentry"); |
GtkWidget *printlowentry, *printrangelabel, *printhighentry; |
1198 |
printhighentry = lookup_widget(printdialog, "printhighentry"); |
|
1199 |
printrangelabel = lookup_widget(printdialog, "printrangelabel"); |
printlowentry = lookup_widget (printdialog, "printlowentry"); |
1200 |
switch(atoi(user_data)) |
printhighentry = lookup_widget (printdialog, "printhighentry"); |
1201 |
{ |
printrangelabel = lookup_widget (printdialog, "printrangelabel"); |
1202 |
case 1: |
switch (atoi (user_data)) |
1203 |
gtk_widget_set_sensitive(printlowentry, 0); |
{ |
1204 |
gtk_widget_set_sensitive(printhighentry, 0); |
case 1: |
1205 |
gtk_widget_set_sensitive(printrangelabel, 0); |
gtk_widget_set_sensitive (printlowentry, 0); |
1206 |
break; |
gtk_widget_set_sensitive (printhighentry, 0); |
1207 |
case 2: |
gtk_widget_set_sensitive (printrangelabel, 0); |
1208 |
gtk_widget_set_sensitive(printlowentry, 1); |
break; |
1209 |
gtk_widget_set_sensitive(printhighentry, 1); |
case 2: |
1210 |
gtk_widget_set_sensitive(printrangelabel, 1); |
gtk_widget_set_sensitive (printlowentry, 1); |
1211 |
break; |
gtk_widget_set_sensitive (printhighentry, 1); |
1212 |
} |
gtk_widget_set_sensitive (printrangelabel, 1); |
1213 |
|
break; |
1214 |
|
} |
1215 |
} |
} |
1216 |
|
|
1217 |
|
|
1218 |
/* SEARCH DIALOG */ |
/* SEARCH DIALOG */ |
1219 |
void on_searchokbutton_clicked (GtkButton *button, gpointer user_data) |
void |
1220 |
|
on_searchokbutton_clicked (GtkButton * button, gpointer user_data) |
1221 |
{ |
{ |
1222 |
gchar *searchstr, *upsearchstr, *callsign, *labeltext; |
gchar *searchstr, *upsearchstr, *callsign, *labeltext; |
1223 |
GtkWidget *searchdialog, *searchresultdialog, *searchcomboentry, |
GtkWidget *searchdialog, *searchresultdialog, *searchcomboentry, |
1224 |
*resultlabel, *searchcheckbutton; |
*resultlabel, *searchcheckbutton; |
1225 |
gint i, row; |
gint i, row; |
1226 |
gboolean result = FALSE, searchopen; |
gboolean result = FALSE, searchopen; |
1227 |
GList *node; |
GList *node; |
1228 |
logtype *logwindow; |
logtype *logwindow; |
1229 |
|
|
1230 |
searchdialog = gtk_widget_get_toplevel(GTK_WIDGET(button)); |
searchdialog = gtk_widget_get_toplevel (GTK_WIDGET (button)); |
1231 |
searchcomboentry = lookup_widget(searchdialog, "searchcomboentry"); |
searchcomboentry = lookup_widget (searchdialog, "searchcomboentry"); |
1232 |
searchcheckbutton = lookup_widget(searchdialog, "searchcheckbutton"); |
searchcheckbutton = lookup_widget (searchdialog, "searchcheckbutton"); |
1233 |
|
|
1234 |
searchopen = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON |
searchopen = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON |
1235 |
(searchcheckbutton)); |
(searchcheckbutton)); |
1236 |
|
|
1237 |
searchstr = |
searchstr = gtk_editable_get_chars (GTK_EDITABLE (searchcomboentry), 0, -1); |
1238 |
gtk_editable_get_chars(GTK_EDITABLE(searchcomboentry), 0 , -1); |
|
1239 |
|
/* add to the searchlist if it is a new one */ |
1240 |
/* add to the searchlist if it is a new one */ |
node = g_list_find_custom (searchhistory, g_strdup (searchstr), |
1241 |
node = g_list_find_custom(searchhistory, g_strdup(searchstr), |
(GCompareFunc) strncmp); |
1242 |
(GCompareFunc)strncmp); |
if (!node) |
1243 |
if (!node) searchhistory = g_list_prepend(searchhistory, |
searchhistory = g_list_prepend (searchhistory, g_strdup (searchstr)); |
1244 |
g_strdup(searchstr)); |
if (g_list_length (searchhistory) > SEARCHHISTORY) |
1245 |
if (g_list_length(searchhistory) > SEARCHHISTORY) |
searchhistory = g_list_remove (searchhistory, |
1246 |
searchhistory = g_list_remove(searchhistory, |
g_list_last (searchhistory)->data); |
1247 |
g_list_last(searchhistory)->data); |
|
1248 |
|
upsearchstr = g_strdup (searchstr); |
1249 |
upsearchstr = g_strdup(searchstr); |
g_strup (upsearchstr); |
1250 |
g_strup(upsearchstr); |
|
1251 |
|
/* search all logs and select corresponding QSO */ |
1252 |
/* search all logs and select corresponding QSO */ |
for (i = state.searchlog; i < g_list_length (logwindowlist); i++) |
1253 |
for (i = state.searchlog; i < g_list_length(logwindowlist); i++) |
{ |
1254 |
{ |
logwindow = g_list_nth_data (logwindowlist, i); |
1255 |
logwindow = g_list_nth_data(logwindowlist, i); |
for (row = state.searchqso; row < logwindow->qsos; row++) |
1256 |
for (row = state.searchqso; row < logwindow->qsos; row++) |
{ |
1257 |
{ |
gtk_clist_get_text (GTK_CLIST (logwindow->clist), row, |
1258 |
gtk_clist_get_text(GTK_CLIST(logwindow->clist), row, |
CALL, &callsign); |
1259 |
CALL, &callsign); |
if (strstr (callsign, upsearchstr)) |
1260 |
if (strstr(callsign, upsearchstr)) |
{ |
1261 |
{ |
gtk_notebook_set_page (GTK_NOTEBOOK (mainnotebook), i); |
1262 |
gtk_notebook_set_page(GTK_NOTEBOOK(mainnotebook), i); |
gtk_clist_moveto (GTK_CLIST (logwindow->clist), row, 0, 0.5, 0); |
1263 |
gtk_clist_moveto(GTK_CLIST(logwindow->clist), row, 0, 0.5, 0); |
gtk_clist_select_row (GTK_CLIST (logwindow->clist), row, 0); |
1264 |
gtk_clist_select_row(GTK_CLIST(logwindow->clist), row, 0); |
result = TRUE; |
1265 |
result = TRUE; |
} |
1266 |
} |
if (result) |
1267 |
if (result) break; |
break; |
|
} |
|
|
/* reset search */ |
|
|
if (row == logwindow->qsos && state.searchlog < g_list_length(logwindowlist)) |
|
|
{ |
|
|
state.searchqso = 0; |
|
|
state.searchlog++; |
|
|
if (state.searchlog == g_list_length(logwindowlist)) |
|
|
state.searchlog = 0; |
|
|
} |
|
|
else state.searchqso = row + 1; |
|
|
if (result) break; |
|
|
} |
|
|
|
|
|
/* not found, show the result */ |
|
|
if (! result) { |
|
|
state.searchqso = 0; |
|
|
searchresultdialog = create_searchresultdialog(); |
|
|
resultlabel = lookup_widget(searchresultdialog, "resultlabel"); |
|
|
labeltext = g_strdup_printf(_("\'%s\' was not found"), searchstr); |
|
|
gtk_label_set_text(GTK_LABEL(resultlabel), labeltext); |
|
|
g_free(labeltext); |
|
|
gtk_widget_show(searchresultdialog); |
|
|
} |
|
|
|
|
|
g_free(searchstr); |
|
|
g_free(upsearchstr); |
|
|
|
|
|
if (!searchopen) |
|
|
{ |
|
|
gtk_widget_set_sensitive(mainwindow, 1); |
|
|
gtk_widget_destroy(searchdialog); |
|
1268 |
} |
} |
1269 |
|
/* reset search */ |
1270 |
|
if (row == logwindow->qsos |
1271 |
|
&& state.searchlog < g_list_length (logwindowlist)) |
1272 |
|
{ |
1273 |
|
state.searchqso = 0; |
1274 |
|
state.searchlog++; |
1275 |
|
if (state.searchlog == g_list_length (logwindowlist)) |
1276 |
|
state.searchlog = 0; |
1277 |
|
} |
1278 |
|
else |
1279 |
|
state.searchqso = row + 1; |
1280 |
|
if (result) |
1281 |
|
break; |
1282 |
|
} |
1283 |
|
|
1284 |
|
/* not found, show the result */ |
1285 |
|
if (!result) |
1286 |
|
{ |
1287 |
|
state.searchqso = 0; |
1288 |
|
searchresultdialog = create_searchresultdialog (); |
1289 |
|
resultlabel = lookup_widget (searchresultdialog, "resultlabel"); |
1290 |
|
labeltext = g_strdup_printf (_("\'%s\' was not found"), searchstr); |
1291 |
|
gtk_label_set_text (GTK_LABEL (resultlabel), labeltext); |
1292 |
|
g_free (labeltext); |
1293 |
|
gtk_widget_show (searchresultdialog); |
1294 |
|
} |
1295 |
|
|
1296 |
|
g_free (searchstr); |
1297 |
|
g_free (upsearchstr); |
1298 |
|
|
1299 |
|
if (!searchopen) |
1300 |
|
{ |
1301 |
|
gtk_widget_set_sensitive (mainwindow, 1); |
1302 |
|
gtk_widget_destroy (searchdialog); |
1303 |
|
} |
1304 |
} |
} |
1305 |
|
|
1306 |
|
|
1307 |
/* search cancel */ |
/* search cancel */ |
1308 |
void on_searchcancelbutton_clicked (GtkButton *button, gpointer user_data) |
void |
1309 |
|
on_searchcancelbutton_clicked (GtkButton * button, gpointer user_data) |
1310 |
{ |
{ |
1311 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1312 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
1313 |
} |
} |
1314 |
|
|
1315 |
/* search changed, reset saved state */ |
/* search changed, reset saved state */ |
1316 |
void on_searchcomboentry_changed (GtkEditable *editable, gpointer user_data) |
void |
1317 |
|
on_searchcomboentry_changed (GtkEditable * editable, gpointer user_data) |
1318 |
{ |
{ |
1319 |
state.searchqso = 0; |
state.searchqso = 0; |
1320 |
state.searchlog = 0; |
state.searchlog = 0; |
1321 |
} |
} |
1322 |
|
|
1323 |
/* toggle 'keep this dialog open' */ |
/* toggle 'keep this dialog open' */ |
1324 |
void on_searchcheckbutton_toggled(GtkToggleButton *togglebutton, gpointer user_data) |
void |
1325 |
{ |
on_searchcheckbutton_toggled (GtkToggleButton * togglebutton, |
1326 |
GtkWidget *searchdialog, *searchcheckbutton; |
gpointer user_data) |
1327 |
gboolean searchopen; |
{ |
1328 |
|
GtkWidget *searchdialog, *searchcheckbutton; |
1329 |
searchdialog = gtk_widget_get_toplevel(GTK_WIDGET(togglebutton)); |
gboolean searchopen; |
1330 |
searchcheckbutton = lookup_widget(searchdialog, "searchcheckbutton"); |
|
1331 |
searchopen = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchcheckbutton)); |
searchdialog = gtk_widget_get_toplevel (GTK_WIDGET (togglebutton)); |
1332 |
if (searchopen) gtk_widget_set_sensitive(mainwindow, 1); |
searchcheckbutton = lookup_widget (searchdialog, "searchcheckbutton"); |
1333 |
else gtk_widget_set_sensitive(mainwindow, 0); |
searchopen = |
1334 |
} |
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (searchcheckbutton)); |
1335 |
|
if (searchopen) |
1336 |
gboolean on_searchdialog_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) |
gtk_widget_set_sensitive (mainwindow, 1); |
1337 |
|
else |
1338 |
|
gtk_widget_set_sensitive (mainwindow, 0); |
1339 |
|
} |
1340 |
|
|
1341 |
|
gboolean |
1342 |
|
on_searchdialog_delete_event (GtkWidget * widget, GdkEvent * event, |
1343 |
|
gpointer user_data) |
1344 |
{ |
{ |
1345 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1346 |
return FALSE; |
return FALSE; |
1347 |
} |
} |
1348 |
|
|
1349 |
/* SEARCHRESULT DIALOG */ |
/* SEARCHRESULT DIALOG */ |
1350 |
void on_searchresultokbutton_clicked(GtkButton *button, gpointer user_data) |
void |
1351 |
|
on_searchresultokbutton_clicked (GtkButton * button, gpointer user_data) |
1352 |
{ |
{ |
1353 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
1354 |
} |
} |
1355 |
|
|
1356 |
/* COLOR SELECTION DIALOG */ |
/* COLOR SELECTION DIALOG */ |
1357 |
void on_colorokbutton_clicked(GtkButton *button, gpointer user_data) |
void |
1358 |
|
on_colorokbutton_clicked (GtkButton * button, gpointer user_data) |
1359 |
{ |
{ |
1360 |
GtkWidget *colorselectiondialog, *examplelabel, *exampleframe; |
GtkWidget *colorselectiondialog, *examplelabel, *exampleframe; |
1361 |
gdouble rgb[3]; |
gdouble rgb[3]; |
1362 |
gchar *colorred, *colorgreen, *colorblue, *color; |
gchar *colorred, *colorgreen, *colorblue, *color; |
1363 |
|
|
1364 |
colorselectiondialog = gtk_widget_get_toplevel(GTK_WIDGET(button)); |
colorselectiondialog = gtk_widget_get_toplevel (GTK_WIDGET (button)); |
1365 |
gtk_color_selection_get_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(colorselectiondialog)->colorsel), rgb); |
gtk_color_selection_get_color (GTK_COLOR_SELECTION |
1366 |
colorred = g_strdup_printf("%04X", (gint)(rgb[0] * 65535)); |
(GTK_COLOR_SELECTION_DIALOG |
1367 |
colorgreen = g_strdup_printf("%04X", (gint)(rgb[1] * 65535)); |
(colorselectiondialog)->colorsel), rgb); |
1368 |
colorblue = g_strdup_printf("%04X", (gint)(rgb[2] * 65535)); |
colorred = g_strdup_printf ("%04X", (gint) (rgb[0] * 65535)); |
1369 |
color = g_strconcat(colorred, ",", colorgreen, ",", colorblue, NULL); |
colorgreen = g_strdup_printf ("%04X", (gint) (rgb[1] * 65535)); |
1370 |
exampleframe = lookup_widget(preferencesdialog, "exampleframe"); |
colorblue = g_strdup_printf ("%04X", (gint) (rgb[2] * 65535)); |
1371 |
setframestyle(exampleframe, color, preferences.themefont); |
color = g_strconcat (colorred, ",", colorgreen, ",", colorblue, NULL); |
1372 |
examplelabel = lookup_widget(preferencesdialog, "examplelabel"); |
exampleframe = lookup_widget (preferencesdialog, "exampleframe"); |
1373 |
setlabelstyle(examplelabel, color, preferences.themefont); |
setframestyle (exampleframe, color, preferences.themefont); |
1374 |
g_free(colorblue); |
examplelabel = lookup_widget (preferencesdialog, "examplelabel"); |
1375 |
g_free(colorgreen); |
setlabelstyle (examplelabel, color, preferences.themefont); |
1376 |
g_free(colorred); |
g_free (colorblue); |
1377 |
g_free(color); |
g_free (colorgreen); |
1378 |
gtk_widget_set_sensitive(preferencesdialog, 1); |
g_free (colorred); |
1379 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
g_free (color); |
1380 |
|
gtk_widget_set_sensitive (preferencesdialog, 1); |
1381 |
|
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
1382 |
} |
} |
1383 |
|
|
1384 |
|
|
1385 |
/* cancel color selection */ |
/* cancel color selection */ |
1386 |
void on_colorcancelbutton_clicked(GtkButton *button, gpointer user_data) |
void |
1387 |
|
on_colorcancelbutton_clicked (GtkButton * button, gpointer user_data) |
1388 |
{ |
{ |
1389 |
gtk_widget_set_sensitive(preferencesdialog, 1); |
gtk_widget_set_sensitive (preferencesdialog, 1); |
1390 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
1391 |
} |
} |
1392 |
|
|
1393 |
/* color selection dialog is deleted */ |
/* color selection dialog is deleted */ |
1394 |
gboolean on_colorselectiondialog_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) |
gboolean |
1395 |
|
on_colorselectiondialog_delete_event (GtkWidget * widget, GdkEvent * event, |
1396 |
|
gpointer user_data) |
1397 |
{ |
{ |
1398 |
gtk_widget_set_sensitive(preferencesdialog, 1); |
gtk_widget_set_sensitive (preferencesdialog, 1); |
1399 |
return FALSE; |
return FALSE; |
1400 |
} |
} |
1401 |
|
|
1402 |
/* NEW LOG DIALOG */ |
/* NEW LOG DIALOG */ |
1403 |
void on_newlogokbutton_clicked(GtkButton *button, gpointer user_data) |
void |
1404 |
|
on_newlogokbutton_clicked (GtkButton * button, gpointer user_data) |
1405 |
{ |
{ |
1406 |
GtkWidget *newlogentry, *newlogdialog, *menubar, *log_editor_menu; |
GtkWidget *newlogentry, *newlogdialog, *menubar, *log_editor_menu; |
1407 |
gchar *entry, *filename, *xlogbackupfile; |
gchar *entry, *filename, *xlogbackupfile; |
1408 |
logtype *logwindow = NULL; |
logtype *logwindow = NULL; |
1409 |
gint i; |
gint i; |
1410 |
LOGDB *lp; |
LOGDB *lp; |
1411 |
gboolean logopen = FALSE, logexist = FALSE; |
gboolean logopen = FALSE, logexist = FALSE; |
1412 |
GString *logs; |
GString *logs; |
1413 |
|
|
1414 |
newlogdialog = gtk_widget_get_toplevel(GTK_WIDGET(button)); |
newlogdialog = gtk_widget_get_toplevel (GTK_WIDGET (button)); |
1415 |
newlogentry = lookup_widget(newlogdialog, "newlogentry"); |
newlogentry = lookup_widget (newlogdialog, "newlogentry"); |
1416 |
entry = gtk_editable_get_chars(GTK_EDITABLE(newlogentry), 0, -1); |
entry = gtk_editable_get_chars (GTK_EDITABLE (newlogentry), 0, -1); |
1417 |
|
|
1418 |
if (strlen(entry) > 0) |
if (strlen (entry) > 0) |
1419 |
{ |
{ |
1420 |
for (i = 0; i < g_list_length(logwindowlist); i++) |
for (i = 0; i < g_list_length (logwindowlist); i++) |
1421 |
{ /* see if the log is already open */ |
{ /* see if the log is already open */ |
1422 |
logwindow = g_list_nth_data(logwindowlist, i); |
logwindow = g_list_nth_data (logwindowlist, i); |
1423 |
if (g_strcasecmp(entry, logwindow->logname) == 0) |
if (g_strcasecmp (entry, logwindow->logname) == 0) |
1424 |
{ |
{ |
1425 |
gtk_notebook_set_page(GTK_NOTEBOOK(mainnotebook), i); |
gtk_notebook_set_page (GTK_NOTEBOOK (mainnotebook), i); |
1426 |
set_qsoframe(logwindow); |
set_qsoframe (logwindow); |
1427 |
logopen = TRUE; |
logopen = TRUE; |
1428 |
break; |
break; |
1429 |
} |
} |
1430 |
} |
} |
1431 |
if (!logopen) |
if (!logopen) |
1432 |
{ /* check if the log exists and open it */ |
{ /* check if the log exists and open it */ |
1433 |
filename = g_strconcat(entry, ".xlog", 0); |
filename = g_strconcat (entry, ".xlog", 0); |
1434 |
logs = getlogs(preferences.savedir, 0); |
logs = getlogs (preferences.savedir, 0); |
1435 |
if (((logs->len) > 0) && (strstr(logs->str, filename))) |
if (((logs->len) > 0) && (strstr (logs->str, filename))) |
1436 |
{ |
{ |
1437 |
logexist = TRUE; |
logexist = TRUE; |
1438 |
filename = g_strconcat(preferences.savedir, G_DIR_SEPARATOR_S, entry, ".xlog", NULL); |
filename = |
1439 |
lp = log_file_open(filename, TYPE_FLOG); |
g_strconcat (preferences.savedir, G_DIR_SEPARATOR_S, entry, |
1440 |
if (lp) |
".xlog", NULL); |
1441 |
{ |
lp = log_file_open (filename, TYPE_FLOG); |
1442 |
logwindow = openlog(lp, entry, state.logwindows++); |
if (lp) |
1443 |
log_file_qso_foreach(lp, fillin_clist, logwindow); |
{ |
1444 |
log_file_close(lp); |
logwindow = openlog (lp, entry, state.logwindows++); |
1445 |
logwindowlist = g_list_append(logwindowlist, logwindow); |
log_file_qso_foreach (lp, fillin_clist, logwindow); |
1446 |
gtk_notebook_set_page(GTK_NOTEBOOK(mainnotebook), state.logwindows - 1); |
log_file_close (lp); |
1447 |
set_qsoframe(logwindow); |
logwindowlist = g_list_append (logwindowlist, logwindow); |
1448 |
xlogbackupfile = g_strconcat(filename, ".backup", NULL); |
gtk_notebook_set_page (GTK_NOTEBOOK (mainnotebook), |
1449 |
savelog(logwindow, xlogbackupfile, TYPE_FLOG); |
state.logwindows - 1); |
1450 |
g_free(xlogbackupfile); |
set_qsoframe (logwindow); |
1451 |
} |
xlogbackupfile = g_strconcat (filename, ".backup", NULL); |
1452 |
g_free(filename); |
savelog (logwindow, xlogbackupfile, TYPE_FLOG); |
1453 |
g_string_free(logs, TRUE); |
g_free (xlogbackupfile); |
|
} |
|
1454 |
} |
} |
1455 |
if ((!logopen) && (!logexist)) |
g_free (filename); |
1456 |
{ /* create a new log */ |
g_string_free (logs, TRUE); |
1457 |
filename = g_strconcat(preferences.savedir, G_DIR_SEPARATOR_S, entry, ".xlog", NULL); |
} |
1458 |
lp = log_file_create(filename, TYPE_FLOG, qso_field_nr, qso_fields, qso_widths); |
} |
1459 |
if (lp) |
if ((!logopen) && (!logexist)) |
1460 |
{ |
{ /* create a new log */ |
1461 |
logwindow = openlog(lp, entry, state.logwindows++); |
filename = |
1462 |
log_file_close(lp); |
g_strconcat (preferences.savedir, G_DIR_SEPARATOR_S, entry, |
1463 |
logwindowlist = g_list_append(logwindowlist, logwindow); |
".xlog", NULL); |
1464 |
gtk_notebook_set_page(GTK_NOTEBOOK(mainnotebook), state.logwindows - 1); |
lp = |
1465 |
set_qsoframe(logwindow); |
log_file_create (filename, TYPE_FLOG, qso_field_nr, qso_fields, |
1466 |
} |
qso_widths); |
1467 |
g_free(filename); |
if (lp) |
1468 |
} |
{ |
1469 |
g_free(entry); |
logwindow = openlog (lp, entry, state.logwindows++); |
1470 |
|
log_file_close (lp); |
1471 |
|
logwindowlist = g_list_append (logwindowlist, logwindow); |
1472 |
|
gtk_notebook_set_page (GTK_NOTEBOOK (mainnotebook), |
1473 |
|
state.logwindows - 1); |
1474 |
|
set_qsoframe (logwindow); |
1475 |
|
} |
1476 |
|
g_free (filename); |
1477 |
} |
} |
1478 |
|
g_free (entry); |
1479 |
|
} |
1480 |
|
|
1481 |
gtk_widget_destroy(newlogdialog); |
gtk_widget_destroy (newlogdialog); |
1482 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1483 |
|
|
1484 |
/* fire up the logeditor */ |
/* fire up the logeditor */ |
1485 |
if ((!logopen) && (!logexist)) |
if ((!logopen) && (!logexist)) |
1486 |
{ |
{ |
1487 |
gtk_widget_set_sensitive(mainwindow, 0); |
gtk_widget_set_sensitive (mainwindow, 0); |
1488 |
menubar = lookup_widget(mainwindow, "menubar"); |
menubar = lookup_widget (mainwindow, "menubar"); |
1489 |
log_editor_menu = lookup_widget(menubar, "log_editor"); |
log_editor_menu = lookup_widget (menubar, "log_editor"); |
1490 |
gtk_signal_emit_by_name(GTK_OBJECT(log_editor_menu),"activate"); |
gtk_signal_emit_by_name (GTK_OBJECT (log_editor_menu), "activate"); |
1491 |
} |
} |
1492 |
} |
} |
1493 |
|
|
1494 |
|
|
1495 |
/* no new log */ |
/* no new log */ |
1496 |
void on_newlogcancelbutton_clicked(GtkButton *button, gpointer user_data) |
void |
1497 |
|
on_newlogcancelbutton_clicked (GtkButton * button, gpointer user_data) |
1498 |
{ |
{ |
1499 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1500 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
1501 |
} |
} |
1502 |
|
|
1503 |
/* new log dialog is deleted */ |
/* new log dialog is deleted */ |
1504 |
gboolean on_newlogdialog_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) |
gboolean |
1505 |
|
on_newlogdialog_delete_event (GtkWidget * widget, GdkEvent * event, |
1506 |
|
gpointer user_data) |
1507 |
{ |
{ |
1508 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1509 |
return FALSE; |
return FALSE; |
1510 |
} |
} |
1511 |
|
|
1512 |
/* OPEN DIALOG */ |
/* OPEN DIALOG */ |
1513 |
void on_fileselection_ok_button_clicked(GtkButton *button, gpointer user_data) |
void |
1514 |
|
on_fileselection_ok_button_clicked (GtkButton * button, gpointer user_data) |
1515 |
{ |
{ |
1516 |
GtkWidget *fileselection, *filemenu, *menu, *item; |
GtkWidget *fileselection, *filemenu, *menu, *item; |
1517 |
gchar *logn, *sellog, *xlogbackupfile, *temp; |
gchar *logn, *sellog, *xlogbackupfile, *temp; |
1518 |
gpointer filen; |
gpointer filen; |
1519 |
gboolean logexist = FALSE; |
gboolean logexist = FALSE; |
1520 |
gint i, filetype; |
gint i, filetype; |
1521 |
logtype *logwindow; |
logtype *logwindow; |
1522 |
LOGDB *lp; |
LOGDB *lp; |
1523 |
|
|
1524 |
fileselection = gtk_widget_get_toplevel(GTK_WIDGET(button)); |
fileselection = gtk_widget_get_toplevel (GTK_WIDGET (button)); |
1525 |
|
|
1526 |
/* skip all if nothing filled in */ |
/* skip all if nothing filled in */ |
1527 |
if (strlen(gtk_editable_get_chars(GTK_EDITABLE(GTK_FILE_SELECTION(fileselection) |
if (strlen |
1528 |
->selection_entry), 0, -1)) > 0) |
(gtk_editable_get_chars |
1529 |
{ |
(GTK_EDITABLE (GTK_FILE_SELECTION (fileselection)->selection_entry), 0, |
1530 |
filemenu = lookup_widget(fileselection, "filemenu"); |
-1)) > 0) |
1531 |
menu = GTK_OPTION_MENU(filemenu)->menu; |
{ |
1532 |
item = gtk_menu_get_active(GTK_MENU(menu)); |
filemenu = lookup_widget (fileselection, "filemenu"); |
1533 |
/* skip old log format (0) */ |
menu = GTK_OPTION_MENU (filemenu)->menu; |
1534 |
filetype = g_list_index(GTK_MENU_SHELL(menu)->children, item) + 1; |
item = gtk_menu_get_active (GTK_MENU (menu)); |
1535 |
|
/* skip old log format (0) */ |
1536 |
/* don't free sellog */ |
filetype = g_list_index (GTK_MENU_SHELL (menu)->children, item) + 1; |
1537 |
sellog = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fileselection)); |
|
1538 |
filen = basename(sellog); |
/* don't free sellog */ |
1539 |
logn = logname((gchar *)filen); |
sellog = |
1540 |
|
gtk_file_selection_get_filename (GTK_FILE_SELECTION (fileselection)); |
1541 |
|
filen = basename (sellog); |
1542 |
|
logn = logname ((gchar *) filen); |
1543 |
|
|
1544 |
/* if log exist jump to the page in the notebook */ |
/* if log exist jump to the page in the notebook */ |
1545 |
for (i = 0; i < g_list_length(logwindowlist); i++) |
for (i = 0; i < g_list_length (logwindowlist); i++) |
1546 |
{ |
{ |
1547 |
logwindow = g_list_nth_data(logwindowlist, i); |
logwindow = g_list_nth_data (logwindowlist, i); |
1548 |
if (g_strcasecmp(logn, logwindow->logname) == 0) |
if (g_strcasecmp (logn, logwindow->logname) == 0) |
1549 |
{ |
{ |
1550 |
gtk_notebook_set_page(GTK_NOTEBOOK(mainnotebook), i); |
gtk_notebook_set_page (GTK_NOTEBOOK (mainnotebook), i); |
1551 |
set_qsoframe(logwindow); |
set_qsoframe (logwindow); |
1552 |
logexist = TRUE; |
logexist = TRUE; |
1553 |
break; |
break; |
1554 |
} |
} |
|
} |
|
|
if (!logexist) |
|
|
{ |
|
|
lp = log_file_open(sellog, filetype); |
|
|
if (lp) |
|
|
{ |
|
|
logwindow = openlog(lp, logn, state.logwindows++); |
|
|
log_file_qso_foreach(lp, fillin_clist, logwindow); |
|
|
log_file_close(lp); |
|
|
if ((lp->type) == TYPE_FLOG) |
|
|
{ |
|
|
xlogbackupfile = g_strconcat(sellog, ".backup", NULL); |
|
|
savelog(logwindow, xlogbackupfile, TYPE_FLOG); |
|
|
g_free(xlogbackupfile); |
|
|
} |
|
|
logwindowlist = g_list_append(logwindowlist, logwindow); |
|
|
gtk_notebook_set_page(GTK_NOTEBOOK(mainnotebook), state.logwindows - 1); |
|
|
set_qsoframe(logwindow); |
|
|
} |
|
|
} |
|
|
g_free(logn); |
|
1555 |
} |
} |
1556 |
else |
if (!logexist) |
1557 |
{ |
{ |
1558 |
temp = g_strdup_printf(_("No filename entered, open cancelled")); |
lp = log_file_open (sellog, filetype); |
1559 |
update_statusbar(temp); |
if (lp) |
1560 |
g_free(temp); |
{ |
1561 |
|
logwindow = openlog (lp, logn, state.logwindows++); |
1562 |
|
log_file_qso_foreach (lp, fillin_clist, logwindow); |
1563 |
|
log_file_close (lp); |
1564 |
|
if ((lp->type) == TYPE_FLOG) |
1565 |
|
{ |
1566 |
|
xlogbackupfile = g_strconcat (sellog, ".backup", NULL); |
1567 |
|
savelog (logwindow, xlogbackupfile, TYPE_FLOG); |
1568 |
|
g_free (xlogbackupfile); |
1569 |
|
} |
1570 |
|
logwindowlist = g_list_append (logwindowlist, logwindow); |
1571 |
|
gtk_notebook_set_page (GTK_NOTEBOOK (mainnotebook), |
1572 |
|
state.logwindows - 1); |
1573 |
|
set_qsoframe (logwindow); |
1574 |
|
} |
1575 |
} |
} |
1576 |
gtk_widget_destroy(fileselection); |
g_free (logn); |
1577 |
gtk_widget_set_sensitive(mainwindow, 1); |
} |
1578 |
|
else |
1579 |
|
{ |
1580 |
|
temp = g_strdup_printf (_("No filename entered, open cancelled")); |
1581 |
|
update_statusbar (temp); |
1582 |
|
g_free (temp); |
1583 |
|
} |
1584 |
|
gtk_widget_destroy (fileselection); |
1585 |
|
gtk_widget_set_sensitive (mainwindow, 1); |
1586 |
} |
} |
1587 |
|
|
1588 |
|
|
1589 |
/* file selection cancelled */ |
/* file selection cancelled */ |
1590 |
void on_fileselection_cancel_button_clicked(GtkButton *button, gpointer user_data) |
void |
1591 |
|
on_fileselection_cancel_button_clicked (GtkButton * button, |
1592 |
|
gpointer user_data) |
1593 |
{ |
{ |
1594 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
1595 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1596 |
} |
} |
1597 |
|
|
1598 |
/* file selection dialog is deleted */ |
/* file selection dialog is deleted */ |
1599 |
gboolean on_fileselection_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) |
gboolean |
1600 |
|
on_fileselection_delete_event (GtkWidget * widget, GdkEvent * event, |
1601 |
|
gpointer user_data) |
1602 |
{ |
{ |
1603 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1604 |
return FALSE; |
return FALSE; |
1605 |
} |
} |
1606 |
|
|
1607 |
/* PATH SELECTION DIALOG */ |
/* PATH SELECTION DIALOG */ |
1608 |
gboolean on_pathselection_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) |
gboolean |
1609 |
|
on_pathselection_delete_event (GtkWidget * widget, GdkEvent * event, |
1610 |
|
gpointer user_data) |
1611 |
{ |
{ |
1612 |
gtk_widget_set_sensitive(preferencesdialog, 1); |
gtk_widget_set_sensitive (preferencesdialog, 1); |
1613 |
return FALSE; |
return FALSE; |
1614 |
} |
} |
1615 |
|
|
1616 |
|
|
1617 |
void on_pathselection_ok_button_clicked(GtkButton *button, gpointer user_data) |
void |
1618 |
|
on_pathselection_ok_button_clicked (GtkButton * button, gpointer user_data) |
1619 |
{ |
{ |
1620 |
GtkWidget *pathselection, *pathentry; |
GtkWidget *pathselection, *pathentry; |
1621 |
gchar *selpath; |
gchar *selpath; |
1622 |
|
|
1623 |
pathselection = gtk_widget_get_toplevel(GTK_WIDGET(button)); |
pathselection = gtk_widget_get_toplevel (GTK_WIDGET (button)); |
1624 |
selpath = gtk_file_selection_get_filename(GTK_FILE_SELECTION(pathselection)); |
selpath = |
1625 |
pathentry = lookup_widget(preferencesdialog, "pathentry"); |
gtk_file_selection_get_filename (GTK_FILE_SELECTION (pathselection)); |
1626 |
gtk_entry_set_text(GTK_ENTRY(pathentry), selpath); |
pathentry = lookup_widget (preferencesdialog, "pathentry"); |
1627 |
gtk_widget_destroy(pathselection); |
gtk_entry_set_text (GTK_ENTRY (pathentry), selpath); |
1628 |
gtk_widget_set_sensitive(preferencesdialog, 1); |
gtk_widget_destroy (pathselection); |
1629 |
|
gtk_widget_set_sensitive (preferencesdialog, 1); |
1630 |
} |
} |
1631 |
|
|
1632 |
|
|
1633 |
void on_pathselection_cancel_button_clicked (GtkButton *button, gpointer user_data) |
void |
1634 |
|
on_pathselection_cancel_button_clicked (GtkButton * button, |
1635 |
|
gpointer user_data) |
1636 |
{ |
{ |
1637 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
1638 |
gtk_widget_set_sensitive(preferencesdialog, 1); |
gtk_widget_set_sensitive (preferencesdialog, 1); |
1639 |
} |
} |
1640 |
|
|
1641 |
/* CLOSE DIALOG */ |
/* CLOSE DIALOG */ |
1642 |
gboolean on_closedialog_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) |
gboolean |
1643 |
|
on_closedialog_delete_event (GtkWidget * widget, GdkEvent * event, |
1644 |
|
gpointer user_data) |
1645 |
{ |
{ |
1646 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1647 |
return FALSE; |
return FALSE; |
1648 |
} |
} |
1649 |
|
|
1650 |
|
|
1651 |
void on_closeokbutton_clicked(GtkButton *button, gpointer user_data) |
void |
1652 |
|
on_closeokbutton_clicked (GtkButton * button, gpointer user_data) |
1653 |
{ |
{ |
1654 |
logtype *logwindow; |
logtype *logwindow; |
1655 |
gint page; |
gint page; |
1656 |
|
|
1657 |
page = gtk_notebook_get_current_page(GTK_NOTEBOOK(mainnotebook)); |
page = gtk_notebook_get_current_page (GTK_NOTEBOOK (mainnotebook)); |
1658 |
logwindow = g_list_nth_data(logwindowlist, page); |
logwindow = g_list_nth_data (logwindowlist, page); |
1659 |
logwindowlist = g_list_remove(logwindowlist, logwindow); |
logwindowlist = g_list_remove (logwindowlist, logwindow); |
1660 |
g_free(logwindow->logname); |
g_free (logwindow->logname); |
1661 |
g_free(logwindow); |
g_free (logwindow); |
1662 |
state.logwindows--; |
state.logwindows--; |
1663 |
gtk_notebook_remove_page(GTK_NOTEBOOK(mainnotebook), page); |
gtk_notebook_remove_page (GTK_NOTEBOOK (mainnotebook), page); |
1664 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
1665 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1666 |
} |
} |
1667 |
|
|
1668 |
|
|
1669 |
void on_closecancelbutton_clicked(GtkButton *button, gpointer user_data) |
void |
1670 |
|
on_closecancelbutton_clicked (GtkButton * button, gpointer user_data) |
1671 |
{ |
{ |
1672 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
1673 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1674 |
} |
} |
1675 |
|
|
1676 |
/* LOG EDITOR */ |
/* LOG EDITOR */ |
1677 |
gboolean on_logeditorwindow_delete_event(GtkWidget *widget, GdkEvent *event, |
gboolean |
1678 |
gpointer user_data) |
on_logeditorwindow_delete_event (GtkWidget * widget, GdkEvent * event, |
1679 |
|
gpointer user_data) |
1680 |
{ |
{ |
1681 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1682 |
return FALSE; |
return FALSE; |
1683 |
} |
} |
1684 |
|
|
1685 |
/* update logfields and return number of columns */ |
/* update logfields and return number of columns */ |
1686 |
static gint update_logfields(gint column, gint logfields[], gchar *showhide) |
static gint |
1687 |
|
update_logfields (gint column, gint logfields[], gchar * showhide) |
1688 |
{ |
{ |
1689 |
gint i, j; |
gint i, j; |
1690 |
|
|
1691 |
for (i = 0; i < QSO_FIELDS; i++) |
for (i = 0; i < QSO_FIELDS; i++) |
1692 |
{ |
{ |
1693 |
if (logfields[i] == column) break; |
if (logfields[i] == column) |
1694 |
} |
break; |
1695 |
/* |
} |
1696 |
* If the column is not present, add it to the end of the array |
/* |
1697 |
* if 'Show' is selected |
* If the column is not present, add it to the end of the array |
1698 |
*/ |
* if 'Show' is selected |
1699 |
if (i == QSO_FIELDS) |
*/ |
1700 |
{ |
if (i == QSO_FIELDS) |
1701 |
if (g_strcasecmp(showhide, _("Show")) == 0) |
{ |
1702 |
{ |
if (g_strcasecmp (showhide, _("Show")) == 0) |
1703 |
for (j = 0; j < QSO_FIELDS; j++) |
{ |
1704 |
if (logfields[j] == 0) |
for (j = 0; j < QSO_FIELDS; j++) |
1705 |
{ |
if (logfields[j] == 0) |
1706 |
logfields[j] = column; |
{ |
1707 |
break; |
logfields[j] = column; |
1708 |
} |
break; |
1709 |
} |
} |
1710 |
} |
} |
1711 |
|
} |
1712 |
|
|
1713 |
/* |
/* |
1714 |
* If the column is present, remove from the array |
* If the column is present, remove from the array |
1715 |
* if 'Hide' is selected |
* if 'Hide' is selected |
1716 |
*/ |
*/ |
1717 |
else |
else |
1718 |
|
{ |
1719 |
|
if (g_strcasecmp (showhide, _("Hide")) == 0) |
1720 |
{ |
{ |
1721 |
if (g_strcasecmp(showhide, _("Hide")) == 0) |
logfields[i] = 0; |
1722 |
|
for (j = 0; j < QSO_FIELDS; j++) |
1723 |
|
{ |
1724 |
|
if (logfields[j] == 0) |
1725 |
{ |
{ |
1726 |
logfields[i] = 0; |
if (logfields[j + 1] == 0) |
1727 |
for (j = 0; j < QSO_FIELDS; j++) |
break; |
1728 |
{ |
/* Shift '0' to the right */ |
1729 |
if (logfields[j] == 0) |
logfields[j] = logfields[j + 1]; |
1730 |
{ |
logfields[j + 1] = 0; |
|
if (logfields[j + 1] == 0) break; |
|
|
/* Shift '0' to the right */ |
|
|
logfields[j] = logfields[j + 1]; |
|
|
logfields[j + 1] = 0; |
|
|
} |
|
|
} |
|
1731 |
} |
} |
1732 |
|
} |
1733 |
} |
} |
1734 |
|
} |
1735 |
|
|
1736 |
for (i = 0; i < QSO_FIELDS; i++) |
for (i = 0; i < QSO_FIELDS; i++) |
1737 |
{ |
{ |
1738 |
if (logfields[i] == 0) break; |
if (logfields[i] == 0) |
1739 |
} |
break; |
1740 |
return(i); |
} |
1741 |
} |
return (i); |
1742 |
|
} |
1743 |
static gint compare_fields(void *f1, void *f2) |
|
1744 |
{ |
static gint |
1745 |
gint *p = f1, *q = f2; |
compare_fields (void *f1, void *f2) |
1746 |
if (*p - *q == *p) return 0; |
{ |
1747 |
else return(*p - *q); |
gint *p = f1, *q = f2; |
1748 |
} |
if (*p - *q == *p) |
1749 |
|
return 0; |
1750 |
void on_logeditorokbutton_clicked(GtkButton *button, gpointer user_data) |
else |
1751 |
{ |
return (*p - *q); |
1752 |
logtype *logw; |
} |
1753 |
GtkWidget *logeditor, *lecomboentry3, *lecomboentry9_10, *lecomboentry11, |
|
1754 |
*lecomboentry12, *lecomboentry13, *lecomboentry14, *lecomboentry15, |
void |
1755 |
*lecomboentry16, *leentry15, *leentry16, *lecomboentry17; |
on_logeditorokbutton_clicked (GtkButton * button, gpointer user_data) |
1756 |
GtkWidget *unknownlabel1, *unknownlabel2, *columnlabel; |
{ |
1757 |
gchar *temp; |
logtype *logw; |
1758 |
gint i, columns, fields[QSO_FIELDS]; |
GtkWidget *logeditor, *lecomboentry3, *lecomboentry9_10, *lecomboentry11, |
1759 |
|
*lecomboentry12, *lecomboentry13, *lecomboentry14, *lecomboentry15, |
1760 |
logw = g_list_nth_data(logwindowlist, |
*lecomboentry16, *leentry15, *leentry16, *lecomboentry17; |
1761 |
gtk_notebook_get_current_page(GTK_NOTEBOOK(mainnotebook))); |
GtkWidget *unknownlabel1, *unknownlabel2, *columnlabel; |
1762 |
|
gchar *temp; |
1763 |
/* fill the field array, unused columns with '0' */ |
gint i, columns, fields[QSO_FIELDS]; |
1764 |
for (i = 0; i < logw->columns; i++) fields[i] = logw->logfields[i]; |
|
1765 |
for (i = logw->columns; i < QSO_FIELDS; i++) fields[i] = 0; |
logw = g_list_nth_data (logwindowlist, |
1766 |
|
gtk_notebook_get_current_page (GTK_NOTEBOOK |
1767 |
logeditor = gtk_widget_get_toplevel(GTK_WIDGET(button)); |
(mainnotebook))); |
1768 |
|
|
1769 |
lecomboentry3 = lookup_widget(logeditor, "lecomboentry3"); |
/* fill the field array, unused columns with '0' */ |
1770 |
temp = gtk_editable_get_chars(GTK_EDITABLE(lecomboentry3), 0, -1); |
for (i = 0; i < logw->columns; i++) |
1771 |
if (g_strcasecmp(temp, _("Hide")) == 0) |
fields[i] = logw->logfields[i]; |
1772 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), GMTEND, FALSE); |
for (i = logw->columns; i < QSO_FIELDS; i++) |
1773 |
else |
fields[i] = 0; |
1774 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), GMTEND, TRUE); |
|
1775 |
columns = update_logfields(GMTEND, fields, temp); |
logeditor = gtk_widget_get_toplevel (GTK_WIDGET (button)); |
1776 |
|
|
1777 |
lecomboentry9_10 = lookup_widget(logeditor, "lecomboentry9_10"); |
lecomboentry3 = lookup_widget (logeditor, "lecomboentry3"); |
1778 |
temp = gtk_editable_get_chars(GTK_EDITABLE(lecomboentry9_10), 0, -1); |
temp = gtk_editable_get_chars (GTK_EDITABLE (lecomboentry3), 0, -1); |
1779 |
if (g_strcasecmp(temp, _("Hide")) == 0) |
if (g_strcasecmp (temp, _("Hide")) == 0) |
1780 |
{ |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), GMTEND, FALSE); |
1781 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), QSLOUT, FALSE); |
else |
1782 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), QSLIN, FALSE); |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), GMTEND, TRUE); |
1783 |
} |
columns = update_logfields (GMTEND, fields, temp); |
1784 |
else |
|
1785 |
{ |
lecomboentry9_10 = lookup_widget (logeditor, "lecomboentry9_10"); |
1786 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), QSLOUT, TRUE); |
temp = gtk_editable_get_chars (GTK_EDITABLE (lecomboentry9_10), 0, -1); |
1787 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), QSLIN, TRUE); |
if (g_strcasecmp (temp, _("Hide")) == 0) |
1788 |
} |
{ |
1789 |
columns = update_logfields(QSLOUT, fields, temp); |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), QSLOUT, |
1790 |
columns = update_logfields(QSLIN, fields, temp); |
FALSE); |
1791 |
|
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), QSLIN, FALSE); |
1792 |
lecomboentry11 = lookup_widget(logeditor, "lecomboentry11"); |
} |
1793 |
temp = gtk_editable_get_chars(GTK_EDITABLE(lecomboentry11), 0, -1); |
else |
1794 |
if (g_strcasecmp(temp, _("Hide")) == 0) |
{ |
1795 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), POWER, FALSE); |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), QSLOUT, TRUE); |
1796 |
else |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), QSLIN, TRUE); |
1797 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), POWER, TRUE); |
} |
1798 |
columns = update_logfields(POWER, fields, temp); |
columns = update_logfields (QSLOUT, fields, temp); |
1799 |
|
columns = update_logfields (QSLIN, fields, temp); |
1800 |
lecomboentry12 = lookup_widget(logeditor, "lecomboentry12"); |
|
1801 |
temp = gtk_editable_get_chars(GTK_EDITABLE(lecomboentry12), 0, -1); |
lecomboentry11 = lookup_widget (logeditor, "lecomboentry11"); |
1802 |
if (g_strcasecmp(temp, _("Hide")) == 0) |
temp = gtk_editable_get_chars (GTK_EDITABLE (lecomboentry11), 0, -1); |
1803 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), NAME, FALSE); |
if (g_strcasecmp (temp, _("Hide")) == 0) |
1804 |
else |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), POWER, FALSE); |
1805 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), NAME, TRUE); |
else |
1806 |
columns = update_logfields(NAME, fields, temp); |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), POWER, TRUE); |
1807 |
|
columns = update_logfields (POWER, fields, temp); |
1808 |
lecomboentry13 = lookup_widget(logeditor, "lecomboentry13"); |
|
1809 |
temp = gtk_editable_get_chars(GTK_EDITABLE(lecomboentry13), 0, -1); |
lecomboentry12 = lookup_widget (logeditor, "lecomboentry12"); |
1810 |
if (g_strcasecmp(temp, _("Hide")) == 0) |
temp = gtk_editable_get_chars (GTK_EDITABLE (lecomboentry12), 0, -1); |
1811 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), QTH, FALSE); |
if (g_strcasecmp (temp, _("Hide")) == 0) |
1812 |
else |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), NAME, FALSE); |
1813 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), QTH, TRUE); |
else |
1814 |
columns = update_logfields(QTH, fields, temp); |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), NAME, TRUE); |
1815 |
|
columns = update_logfields (NAME, fields, temp); |
1816 |
lecomboentry14 = lookup_widget(logeditor, "lecomboentry14"); |
|
1817 |
temp = gtk_editable_get_chars(GTK_EDITABLE(lecomboentry14), 0, -1); |
lecomboentry13 = lookup_widget (logeditor, "lecomboentry13"); |
1818 |
if (g_strcasecmp(temp, _("Hide")) == 0) |
temp = gtk_editable_get_chars (GTK_EDITABLE (lecomboentry13), 0, -1); |
1819 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), LOCATOR, FALSE); |
if (g_strcasecmp (temp, _("Hide")) == 0) |
1820 |
else |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), QTH, FALSE); |
1821 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), LOCATOR, TRUE); |
else |
1822 |
columns = update_logfields(LOCATOR, fields, temp); |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), QTH, TRUE); |
1823 |
|
columns = update_logfields (QTH, fields, temp); |
1824 |
lecomboentry15 = lookup_widget(logeditor, "lecomboentry15"); |
|
1825 |
temp = gtk_editable_get_chars(GTK_EDITABLE(lecomboentry15), 0, -1); |
lecomboentry14 = lookup_widget (logeditor, "lecomboentry14"); |
1826 |
if (g_strcasecmp(temp, _("Hide")) == 0) |
temp = gtk_editable_get_chars (GTK_EDITABLE (lecomboentry14), 0, -1); |
1827 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), U1, FALSE); |
if (g_strcasecmp (temp, _("Hide")) == 0) |
1828 |
else |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), LOCATOR, FALSE); |
1829 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), U1, TRUE); |
else |
1830 |
columns = update_logfields(U1, fields, temp); |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), LOCATOR, TRUE); |
1831 |
|
columns = update_logfields (LOCATOR, fields, temp); |
1832 |
lecomboentry16 = lookup_widget(logeditor, "lecomboentry16"); |
|
1833 |
temp = gtk_editable_get_chars(GTK_EDITABLE(lecomboentry16), 0, -1); |
lecomboentry15 = lookup_widget (logeditor, "lecomboentry15"); |
1834 |
if (g_strcasecmp(temp, _("Hide")) == 0) |
temp = gtk_editable_get_chars (GTK_EDITABLE (lecomboentry15), 0, -1); |
1835 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), U2, FALSE); |
if (g_strcasecmp (temp, _("Hide")) == 0) |
1836 |
else |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), U1, FALSE); |
1837 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), U2, TRUE); |
else |
1838 |
columns = update_logfields(U2, fields, temp); |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), U1, TRUE); |
1839 |
|
columns = update_logfields (U1, fields, temp); |
1840 |
lecomboentry17 = lookup_widget(logeditor, "lecomboentry17"); |
|
1841 |
temp = gtk_editable_get_chars(GTK_EDITABLE(lecomboentry17), 0, -1); |
lecomboentry16 = lookup_widget (logeditor, "lecomboentry16"); |
1842 |
if (g_strcasecmp(temp, _("Hide")) == 0) |
temp = gtk_editable_get_chars (GTK_EDITABLE (lecomboentry16), 0, -1); |
1843 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), REMARKS, FALSE); |
if (g_strcasecmp (temp, _("Hide")) == 0) |
1844 |
else |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), U2, FALSE); |
1845 |
gtk_clist_set_column_visibility(GTK_CLIST(logw->clist), REMARKS, TRUE); |
else |
1846 |
columns = update_logfields(REMARKS, fields, temp); |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), U2, TRUE); |
1847 |
|
columns = update_logfields (U2, fields, temp); |
1848 |
/* see if the array has changed */ |
|
1849 |
for (i = 0; i < QSO_FIELDS; i++) |
lecomboentry17 = lookup_widget (logeditor, "lecomboentry17"); |
1850 |
if (fields[i] != logw->logfields[i]) break; |
temp = gtk_editable_get_chars (GTK_EDITABLE (lecomboentry17), 0, -1); |
1851 |
|
if (g_strcasecmp (temp, _("Hide")) == 0) |
1852 |
/* copy and re-order the array */ |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), REMARKS, FALSE); |
1853 |
qsort(fields, QSO_FIELDS, sizeof(gint), (__compar_fn_t)compare_fields); |
else |
1854 |
if (i < QSO_FIELDS) |
gtk_clist_set_column_visibility (GTK_CLIST (logw->clist), REMARKS, TRUE); |
1855 |
{ |
columns = update_logfields (REMARKS, fields, temp); |
1856 |
for (i = 0; i < QSO_FIELDS; i++) |
|
1857 |
logw->logfields[i] = fields[i]; |
/* see if the array has changed */ |
1858 |
logw->columns = columns; |
for (i = 0; i < QSO_FIELDS; i++) |
1859 |
} |
if (fields[i] != logw->logfields[i]) |
1860 |
|
break; |
1861 |
/* check names of free fields and set column labels and labels on the QSO frame */ |
|
1862 |
leentry15 = lookup_widget(logeditor, "leentry15"); |
/* copy and re-order the array */ |
1863 |
leentry16 = lookup_widget(logeditor, "leentry16"); |
qsort (fields, QSO_FIELDS, sizeof (gint), (__compar_fn_t) compare_fields); |
1864 |
temp = gtk_editable_get_chars(GTK_EDITABLE(leentry15), 0, -1); |
if (i < QSO_FIELDS) |
1865 |
if (g_strcasecmp(temp, preferences.freefield1) != 0) |
{ |
1866 |
{ |
for (i = 0; i < QSO_FIELDS; i++) |
1867 |
if (strlen(temp) == 0) |
logw->logfields[i] = fields[i]; |
1868 |
temp = g_strdup("UNKNOWN"); |
logw->columns = columns; |
1869 |
preferences.freefield1 = g_strdup(temp); |
} |
1870 |
unknownlabel1 = lookup_widget(mainwindow, "unknownlabel1"); |
|
1871 |
gtk_label_set_text(GTK_LABEL(unknownlabel1), temp); |
/* check names of free fields and set column labels and labels on the QSO frame */ |
1872 |
columnlabel = gtk_label_new(temp); |
leentry15 = lookup_widget (logeditor, "leentry15"); |
1873 |
gtk_clist_set_column_widget(GTK_CLIST(logw->clist), U1, columnlabel); |
leentry16 = lookup_widget (logeditor, "leentry16"); |
1874 |
} |
temp = gtk_editable_get_chars (GTK_EDITABLE (leentry15), 0, -1); |
1875 |
temp = gtk_editable_get_chars(GTK_EDITABLE(leentry16), 0, -1); |
if (g_strcasecmp (temp, preferences.freefield1) != 0) |
1876 |
if (g_strcasecmp(temp, preferences.freefield2) != 0) |
{ |
1877 |
{ |
if (strlen (temp) == 0) |
1878 |
if (strlen(temp) == 0) |
temp = g_strdup ("UNKNOWN"); |
1879 |
temp = g_strdup("UNKNOWN"); |
preferences.freefield1 = g_strdup (temp); |
1880 |
preferences.freefield2 = g_strdup(temp); |
unknownlabel1 = lookup_widget (mainwindow, "unknownlabel1"); |
1881 |
unknownlabel2 = lookup_widget(mainwindow, "unknownlabel2"); |
gtk_label_set_text (GTK_LABEL (unknownlabel1), temp); |
1882 |
gtk_label_set_text(GTK_LABEL(unknownlabel2), temp); |
columnlabel = gtk_label_new (temp); |
1883 |
columnlabel = gtk_label_new(temp); |
gtk_clist_set_column_widget (GTK_CLIST (logw->clist), U1, columnlabel); |
1884 |
gtk_clist_set_column_widget(GTK_CLIST(logw->clist), U2, columnlabel); |
} |
1885 |
} |
temp = gtk_editable_get_chars (GTK_EDITABLE (leentry16), 0, -1); |
1886 |
|
if (g_strcasecmp (temp, preferences.freefield2) != 0) |
1887 |
g_free(temp); |
{ |
1888 |
gtk_widget_destroy(logeditor); |
if (strlen (temp) == 0) |
1889 |
set_qsoframe(logw); |
temp = g_strdup ("UNKNOWN"); |
1890 |
gtk_widget_set_sensitive(mainwindow, 1); |
preferences.freefield2 = g_strdup (temp); |
1891 |
|
unknownlabel2 = lookup_widget (mainwindow, "unknownlabel2"); |
1892 |
|
gtk_label_set_text (GTK_LABEL (unknownlabel2), temp); |
1893 |
|
columnlabel = gtk_label_new (temp); |
1894 |
|
gtk_clist_set_column_widget (GTK_CLIST (logw->clist), U2, columnlabel); |
1895 |
|
} |
1896 |
|
|
1897 |
|
g_free (temp); |
1898 |
|
gtk_widget_destroy (logeditor); |
1899 |
|
set_qsoframe (logw); |
1900 |
|
gtk_widget_set_sensitive (mainwindow, 1); |
1901 |
} |
} |
1902 |
|
|
1903 |
|
|
1904 |
void on_logeditorcancelbutton_clicked(GtkButton *button, gpointer user_data) |
void |
1905 |
|
on_logeditorcancelbutton_clicked (GtkButton * button, gpointer user_data) |
1906 |
{ |
{ |
1907 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
1908 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1909 |
} |
} |
1910 |
|
|
1911 |
/* SAVE AS DIALOG */ |
/* SAVE AS DIALOG */ |
1912 |
void on_saveasok_button_clicked(GtkButton *button, gpointer user_data) |
void |
1913 |
|
on_saveasok_button_clicked (GtkButton * button, gpointer user_data) |
1914 |
{ |
{ |
1915 |
GtkWidget *saveasdialog, *saveasmenu, *menu, *item, *savewarningdialog, |
GtkWidget *saveasdialog, *saveasmenu, *menu, *item, *savewarningdialog, |
1916 |
*savewarninglabel; |
*savewarninglabel; |
1917 |
gchar *temp, *rev; |
gchar *temp, *rev; |
1918 |
gint index; |
gint index; |
1919 |
logtype *logwindow; |
logtype *logwindow; |
1920 |
gboolean warning = FALSE; |
gboolean warning = FALSE; |
1921 |
|
|
1922 |
saveasdialog = gtk_widget_get_toplevel(GTK_WIDGET(button)); |
saveasdialog = gtk_widget_get_toplevel (GTK_WIDGET (button)); |
1923 |
saveasmenu = lookup_widget(saveasdialog, "saveasmenu"); |
saveasmenu = lookup_widget (saveasdialog, "saveasmenu"); |
1924 |
menu = GTK_OPTION_MENU(saveasmenu)->menu; |
menu = GTK_OPTION_MENU (saveasmenu)->menu; |
1925 |
item = gtk_menu_get_active(GTK_MENU(menu)); |
item = gtk_menu_get_active (GTK_MENU (menu)); |
1926 |
index = g_list_index(GTK_MENU_SHELL(menu)->children, item); |
index = g_list_index (GTK_MENU_SHELL (menu)->children, item); |
1927 |
|
|
1928 |
if (index == 0) globtype = 1; |
if (index == 0) |
1929 |
else if (index == 1) globtype = 3; |
globtype = 1; |
1930 |
else globtype = 4; |
else if (index == 1) |
1931 |
|
globtype = 3; |
1932 |
globtemp = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(saveasdialog))); |
else |
1933 |
rev = g_strdup(globtemp); |
globtype = 4; |
1934 |
g_strreverse(rev); |
|
1935 |
if (!g_strncasecmp(rev, "/", 1)) |
globtemp = |
1936 |
{ |
g_strdup (gtk_file_selection_get_filename |
1937 |
temp = g_strdup_printf(_("No filename entered, log not saved")); |
(GTK_FILE_SELECTION (saveasdialog))); |
1938 |
update_statusbar(temp); |
rev = g_strdup (globtemp); |
1939 |
} |
g_strreverse (rev); |
1940 |
else |
if (!g_strncasecmp (rev, "/", 1)) |
1941 |
{ |
{ |
1942 |
if (! fileexist(globtemp)) |
temp = g_strdup_printf (_("No filename entered, log not saved")); |
1943 |
{ |
update_statusbar (temp); |
1944 |
logwindow = g_list_nth_data(logwindowlist, |
} |
1945 |
gtk_notebook_get_current_page(GTK_NOTEBOOK(mainnotebook))); |
else |
1946 |
savelog(logwindow, globtemp, globtype); |
{ |
1947 |
temp = g_strdup_printf(_("Log saved to %s"), globtemp); |
if (!fileexist (globtemp)) |
1948 |
update_statusbar(temp); |
{ |
1949 |
} |
logwindow = g_list_nth_data (logwindowlist, |
1950 |
else |
gtk_notebook_get_current_page |
1951 |
{ |
(GTK_NOTEBOOK (mainnotebook))); |
1952 |
savewarningdialog = create_savewarningdialog(); |
savelog (logwindow, globtemp, globtype); |
1953 |
savewarninglabel = lookup_widget(savewarningdialog, "savewarninglabel"); |
temp = g_strdup_printf (_("Log saved to %s"), globtemp); |
1954 |
temp = g_strdup_printf(_("%s already exist, do want to overwrite it?"), globtemp); |
update_statusbar (temp); |
1955 |
gtk_label_set_text(GTK_LABEL(savewarninglabel), temp); |
} |
1956 |
gtk_widget_show(savewarningdialog); |
else |
1957 |
warning = TRUE; |
{ |
1958 |
} |
savewarningdialog = create_savewarningdialog (); |
1959 |
} |
savewarninglabel = |
1960 |
g_free(temp); |
lookup_widget (savewarningdialog, "savewarninglabel"); |
1961 |
g_free(rev); |
temp = |
1962 |
|
g_strdup_printf (_("%s already exist, do want to overwrite it?"), |
1963 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
globtemp); |
1964 |
if (!warning) gtk_widget_set_sensitive(mainwindow, 1); |
gtk_label_set_text (GTK_LABEL (savewarninglabel), temp); |
1965 |
|
gtk_widget_show (savewarningdialog); |
1966 |
|
warning = TRUE; |
1967 |
|
} |
1968 |
|
} |
1969 |
|
g_free (temp); |
1970 |
|
g_free (rev); |
1971 |
|
|
1972 |
|
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
1973 |
|
if (!warning) |
1974 |
|
gtk_widget_set_sensitive (mainwindow, 1); |
1975 |
} |
} |
1976 |
|
|
1977 |
/* delete save as dialog */ |
/* delete save as dialog */ |
1978 |
gboolean on_saveasdialog_delete_event(GtkWidget *widget, GdkEvent *event, |
gboolean |
1979 |
gpointer user_data) |
on_saveasdialog_delete_event (GtkWidget * widget, GdkEvent * event, |
1980 |
|
gpointer user_data) |
1981 |
{ |
{ |
1982 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1983 |
return FALSE; |
return FALSE; |
1984 |
} |
} |
1985 |
|
|
1986 |
|
|
1987 |
/* cancel save as */ |
/* cancel save as */ |
1988 |
void on_saveas_cancel_button_clicked(GtkButton *button, gpointer user_data) |
void |
1989 |
|
on_saveas_cancel_button_clicked (GtkButton * button, gpointer user_data) |
1990 |
{ |
{ |
1991 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
1992 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
1993 |
} |
} |
1994 |
|
|
1995 |
/* FONT SELECTION DIALOG */ |
/* FONT SELECTION DIALOG */ |
1996 |
void on_fontokbutton_clicked(GtkButton *button, gpointer user_data) |
void |
1997 |
|
on_fontokbutton_clicked (GtkButton * button, gpointer user_data) |
1998 |
{ |
{ |
1999 |
GtkWidget *fontselectiondialog, *fontentry, *exampleframe, |
GtkWidget *fontselectiondialog, *fontentry, *exampleframe, *examplelabel; |
2000 |
*examplelabel; |
gchar *font; |
2001 |
gchar *font; |
|
2002 |
|
fontselectiondialog = gtk_widget_get_toplevel (GTK_WIDGET (button)); |
2003 |
fontselectiondialog = gtk_widget_get_toplevel(GTK_WIDGET(button)); |
font = gtk_font_selection_dialog_get_font_name |
2004 |
font = gtk_font_selection_dialog_get_font_name |
(GTK_FONT_SELECTION_DIALOG (fontselectiondialog)); |
2005 |
(GTK_FONT_SELECTION_DIALOG(fontselectiondialog)); |
fontentry = lookup_widget (preferencesdialog, "fontentry"); |
2006 |
fontentry = lookup_widget(preferencesdialog, "fontentry"); |
gtk_entry_set_text (GTK_ENTRY (fontentry), font); |
2007 |
gtk_entry_set_text(GTK_ENTRY(fontentry), font); |
exampleframe = lookup_widget (preferencesdialog, "exampleframe"); |
2008 |
exampleframe = lookup_widget(preferencesdialog, "exampleframe"); |
setframestyle (exampleframe, preferences.themecolor, font); |
2009 |
setframestyle(exampleframe, preferences.themecolor, font); |
examplelabel = lookup_widget (preferencesdialog, "examplelabel"); |
2010 |
examplelabel = lookup_widget(preferencesdialog, "examplelabel"); |
setlabelstyle (examplelabel, preferences.themecolor, font); |
2011 |
setlabelstyle(examplelabel, preferences.themecolor, font); |
gtk_widget_set_sensitive (preferencesdialog, 1); |
2012 |
gtk_widget_set_sensitive(preferencesdialog, 1); |
gtk_widget_destroy (fontselectiondialog); |
|
gtk_widget_destroy(fontselectiondialog); |
|
2013 |
} |
} |
2014 |
|
|
2015 |
|
|
2016 |
/* delete font selection dialog */ |
/* delete font selection dialog */ |
2017 |
gboolean on_fontselectiondialog_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) |
gboolean |
2018 |
|
on_fontselectiondialog_delete_event (GtkWidget * widget, GdkEvent * event, |
2019 |
|
gpointer user_data) |
2020 |
{ |
{ |
2021 |
gtk_widget_set_sensitive(preferencesdialog, 1); |
gtk_widget_set_sensitive (preferencesdialog, 1); |
2022 |
return FALSE; |
return FALSE; |
2023 |
} |
} |
2024 |
|
|
2025 |
/* cancel font selection */ |
/* cancel font selection */ |
2026 |
void on_fontcancelbutton_clicked (GtkButton *button, gpointer user_data) |
void |
2027 |
|
on_fontcancelbutton_clicked (GtkButton * button, gpointer user_data) |
2028 |
{ |
{ |
2029 |
gtk_widget_set_sensitive(preferencesdialog, 1); |
gtk_widget_set_sensitive (preferencesdialog, 1); |
2030 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
2031 |
} |
} |
2032 |
|
|
2033 |
/* DUPE CHECK DIALOG */ |
/* DUPE CHECK DIALOG */ |
2034 |
void on_dupecheckokbutton_clicked(GtkButton *button, gpointer user_data) |
void |
2035 |
|
on_dupecheckokbutton_clicked (GtkButton * button, gpointer user_data) |
2036 |
{ |
{ |
2037 |
GtkWidget *dupecheckdialog, *dupecheckthisradiobutton, *dupelistdialog, |
GtkWidget *dupecheckdialog, *dupecheckthisradiobutton, *dupelistdialog, |
2038 |
*duperesultclist, *dupecheckstatusbar, *dupecheckprogressbar, |
*duperesultclist, *dupecheckstatusbar, *dupecheckprogressbar, |
2039 |
*dupecheckbuttonmode, *dupecheckbuttonband, *duperesultdialog; |
*dupecheckbuttonmode, *dupecheckbuttonband, *duperesultdialog; |
2040 |
GList *dupelist = NULL; |
GList *dupelist = NULL; |
2041 |
logtype *logwindow; |
logtype *logwindow; |
2042 |
gint i, page, savedpage, pages, row, step, duperow = 0; |
gint i, page, savedpage, pages, row, step, duperow = 0; |
2043 |
gchar *logn, *prevlogn, *nr, *prevnr, *date, *gmt, *callsign, *band, |
gchar *logn, *prevlogn, *nr, *prevnr, *date, *gmt, *callsign, *band, |
2044 |
*mode, *temp, *str, *dupestr; |
*mode, *temp, *str, *dupestr; |
2045 |
gchar **dupe = NULL; |
gchar **dupe = NULL; |
2046 |
gfloat new_val; |
gfloat new_val; |
2047 |
GtkAdjustment *adj; |
GtkAdjustment *adj; |
2048 |
gboolean dupefound = FALSE; |
gboolean dupefound = FALSE; |
2049 |
|
|
2050 |
dupe = g_new0(gchar *, 7); |
dupe = g_new0 (gchar *, 7); |
2051 |
for (i = 0; i < 7; i++) |
for (i = 0; i < 7; i++) |
2052 |
dupe[i] = g_new0(gchar, 100); |
dupe[i] = g_new0 (gchar, 100); |
2053 |
|
|
2054 |
dupecheckdialog = gtk_widget_get_toplevel(GTK_WIDGET(button)); |
dupecheckdialog = gtk_widget_get_toplevel (GTK_WIDGET (button)); |
2055 |
dupecheckthisradiobutton = lookup_widget(dupecheckdialog, |
dupecheckthisradiobutton = lookup_widget (dupecheckdialog, |
2056 |
"dupecheckthisradiobutton"); |
"dupecheckthisradiobutton"); |
2057 |
dupecheckbuttonmode = lookup_widget(dupecheckdialog, "dupecheckbuttonmode"); |
dupecheckbuttonmode = |
2058 |
dupecheckbuttonband = lookup_widget(dupecheckdialog, "dupecheckbuttonband"); |
lookup_widget (dupecheckdialog, "dupecheckbuttonmode"); |
2059 |
dupecheckstatusbar = lookup_widget(dupecheckdialog, "dupecheckstatusbar"); |
dupecheckbuttonband = |
2060 |
dupecheckprogressbar = lookup_widget(dupecheckdialog, "dupecheckprogressbar"); |
lookup_widget (dupecheckdialog, "dupecheckbuttonband"); |
2061 |
gtk_statusbar_pop(GTK_STATUSBAR(dupecheckstatusbar), 1); |
dupecheckstatusbar = lookup_widget (dupecheckdialog, "dupecheckstatusbar"); |
2062 |
gtk_statusbar_push(GTK_STATUSBAR(dupecheckstatusbar), 1, _("Searching ...")); |
dupecheckprogressbar = |
2063 |
gtkut_widget_wait_for_draw(GTK_WIDGET(dupecheckstatusbar)->parent); |
lookup_widget (dupecheckdialog, "dupecheckprogressbar"); |
2064 |
|
gtk_statusbar_pop (GTK_STATUSBAR (dupecheckstatusbar), 1); |
2065 |
/* this or all logs ? */ |
gtk_statusbar_push (GTK_STATUSBAR (dupecheckstatusbar), 1, |
2066 |
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dupecheckthisradiobutton))) |
_("Searching ...")); |
2067 |
state.dupecheck = 0; |
gtkut_widget_wait_for_draw (GTK_WIDGET (dupecheckstatusbar)->parent); |
2068 |
else |
|
2069 |
state.dupecheck = 1; |
/* this or all logs ? */ |
2070 |
state.notdupecheckmode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dupecheckbuttonmode)); |
if (gtk_toggle_button_get_active |
2071 |
state.notdupecheckband = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dupecheckbuttonband)); |
(GTK_TOGGLE_BUTTON (dupecheckthisradiobutton))) |
2072 |
|
state.dupecheck = 0; |
2073 |
/* set autosort and sort item for the result dialog */ |
else |
2074 |
dupelistdialog = create_dupelistdialog(); |
state.dupecheck = 1; |
2075 |
duperesultclist = lookup_widget(dupelistdialog, "duperesultclist"); |
state.notdupecheckmode = |
2076 |
gtk_clist_set_sort_column(GTK_CLIST(duperesultclist), 4); |
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dupecheckbuttonmode)); |
2077 |
gtk_clist_set_auto_sort(GTK_CLIST(duperesultclist), TRUE); |
state.notdupecheckband = |
2078 |
for (i = 0; i < 7; i++) |
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dupecheckbuttonband)); |
2079 |
gtk_clist_set_column_auto_resize(GTK_CLIST(duperesultclist), i, TRUE); |
|
2080 |
|
/* set autosort and sort item for the result dialog */ |
2081 |
if (state.dupecheck == 0) |
dupelistdialog = create_dupelistdialog (); |
2082 |
{ |
duperesultclist = lookup_widget (dupelistdialog, "duperesultclist"); |
2083 |
page = gtk_notebook_get_current_page(GTK_NOTEBOOK(mainnotebook)); |
gtk_clist_set_sort_column (GTK_CLIST (duperesultclist), 4); |
2084 |
pages = page + 1; |
gtk_clist_set_auto_sort (GTK_CLIST (duperesultclist), TRUE); |
2085 |
} |
for (i = 0; i < 7; i++) |
2086 |
else |
gtk_clist_set_column_auto_resize (GTK_CLIST (duperesultclist), i, TRUE); |
2087 |
{ |
|
2088 |
page = 0; |
if (state.dupecheck == 0) |
2089 |
pages = g_list_length(logwindowlist); |
{ |
2090 |
} |
page = gtk_notebook_get_current_page (GTK_NOTEBOOK (mainnotebook)); |
2091 |
|
pages = page + 1; |
2092 |
/* traverse 2 times down the log(s) */ |
} |
2093 |
savedpage = page; |
else |
2094 |
while (page < pages) |
{ |
2095 |
{ |
page = 0; |
2096 |
logwindow = g_list_nth_data(logwindowlist, page); |
pages = g_list_length (logwindowlist); |
2097 |
/* compose a list with items to scan for */ |
} |
2098 |
for (row = 0; row < logwindow->qsos; row++) |
|
2099 |
{ |
/* traverse 2 times down the log(s) */ |
2100 |
gtk_clist_get_text(GTK_CLIST(logwindow->clist), row, CALL, &temp); |
savedpage = page; |
2101 |
if (! state.notdupecheckband) |
while (page < pages) |
2102 |
{ |
{ |
2103 |
gtk_clist_get_text(GTK_CLIST(logwindow->clist), row, BAND, &band); |
logwindow = g_list_nth_data (logwindowlist, page); |
2104 |
str = findband(g_strdup(band)); |
/* compose a list with items to scan for */ |
2105 |
temp = g_strconcat(temp, str, NULL); |
for (row = 0; row < logwindow->qsos; row++) |
2106 |
g_free(str); |
{ |
2107 |
} |
gtk_clist_get_text (GTK_CLIST (logwindow->clist), row, CALL, &temp); |
2108 |
if (! state.notdupecheckmode) |
if (!state.notdupecheckband) |
2109 |
{ |
{ |
2110 |
gtk_clist_get_text(GTK_CLIST(logwindow->clist), row, MODE, &mode); |
gtk_clist_get_text (GTK_CLIST (logwindow->clist), row, BAND, |
2111 |
temp = g_strconcat(temp, mode, NULL); |
&band); |
2112 |
} |
str = findband (g_strdup (band)); |
2113 |
dupelist = g_list_append(dupelist, temp); |
temp = g_strconcat (temp, str, NULL); |
2114 |
|
g_free (str); |
2115 |
|
} |
2116 |
|
if (!state.notdupecheckmode) |
2117 |
|
{ |
2118 |
|
gtk_clist_get_text (GTK_CLIST (logwindow->clist), row, MODE, |
2119 |
|
&mode); |
2120 |
|
temp = g_strconcat (temp, mode, NULL); |
2121 |
} |
} |
2122 |
page++; |
dupelist = g_list_append (dupelist, temp); |
2123 |
} |
} |
2124 |
|
page++; |
2125 |
|
} |
2126 |
|
|
2127 |
page = savedpage; |
page = savedpage; |
2128 |
while (page < pages) |
while (page < pages) |
2129 |
|
{ |
2130 |
|
logwindow = g_list_nth_data (logwindowlist, page); |
2131 |
|
for (row = 0; row < logwindow->qsos; row++) |
2132 |
{ |
{ |
2133 |
logwindow = g_list_nth_data(logwindowlist, page); |
if (row % 10 == 0) /* advance progress bar */ |
2134 |
for (row = 0; row < logwindow->qsos; row++) |
{ |
2135 |
{ |
new_val = |
2136 |
if (row % 10 == 0) /* advance progress bar */ |
gtk_progress_get_value (GTK_PROGRESS (dupecheckprogressbar)) + |
2137 |
{ |
1; |
2138 |
new_val = gtk_progress_get_value(GTK_PROGRESS(dupecheckprogressbar)) + 1; |
adj = GTK_PROGRESS (dupecheckprogressbar)->adjustment; |
2139 |
adj = GTK_PROGRESS(dupecheckprogressbar)->adjustment; |
if (new_val > adj->upper) |
2140 |
if (new_val > adj->upper) new_val = adj->lower; |
new_val = adj->lower; |
2141 |
gtk_progress_set_value (GTK_PROGRESS(dupecheckprogressbar), new_val); |
gtk_progress_set_value (GTK_PROGRESS (dupecheckprogressbar), |
2142 |
while (gtk_events_pending()) gtk_main_iteration(); |
new_val); |
2143 |
} |
while (gtk_events_pending ()) |
2144 |
gtk_clist_get_text(GTK_CLIST(logwindow->clist), row, CALL, &temp); |
gtk_main_iteration (); |
2145 |
if (! state.notdupecheckband) |
} |
2146 |
{ |
gtk_clist_get_text (GTK_CLIST (logwindow->clist), row, CALL, &temp); |
2147 |
gtk_clist_get_text(GTK_CLIST(logwindow->clist), row, BAND, &band); |
if (!state.notdupecheckband) |
2148 |
str = findband(g_strdup(band)); |
{ |
2149 |
temp = g_strconcat(temp, str, NULL); |
gtk_clist_get_text (GTK_CLIST (logwindow->clist), row, BAND, |
2150 |
g_free(str); |
&band); |
2151 |
} |
str = findband (g_strdup (band)); |
2152 |
if (! state.notdupecheckmode) |
temp = g_strconcat (temp, str, NULL); |
2153 |
{ |
g_free (str); |
2154 |
gtk_clist_get_text(GTK_CLIST(logwindow->clist), row, MODE, &mode); |
} |
2155 |
temp = g_strconcat(temp, mode, NULL); |
if (!state.notdupecheckmode) |
2156 |
} |
{ |
2157 |
dupestr = g_strdup(temp); |
gtk_clist_get_text (GTK_CLIST (logwindow->clist), row, MODE, |
2158 |
for (step = 0; step < logwindow->qsos; step++) |
&mode); |
2159 |
{ |
temp = g_strconcat (temp, mode, NULL); |
2160 |
if (g_strcasecmp(dupestr, g_list_nth_data(dupelist, step)) == 0) |
} |
2161 |
{ /* dupe found ? */ |
dupestr = g_strdup (temp); |
2162 |
gtk_clist_get_text(GTK_CLIST(logwindow->clist), row, NR, &nr); |
for (step = 0; step < logwindow->qsos; step++) |
2163 |
if ((logwindow->qsos)-step != atoi(nr)) |
{ |
2164 |
{ |
if (g_strcasecmp (dupestr, g_list_nth_data (dupelist, step)) == |
2165 |
dupe[0] = g_strdup(logwindow->logname); |
0) |
2166 |
dupe[1] = g_strdup(nr); |
{ /* dupe found ? */ |
2167 |
gtk_clist_get_text(GTK_CLIST(logwindow->clist), row, DATE, &date); |
gtk_clist_get_text (GTK_CLIST (logwindow->clist), row, NR, |
2168 |
dupe[2] = g_strdup(date); |
&nr); |
2169 |
gtk_clist_get_text(GTK_CLIST(logwindow->clist), row, GMT, &gmt); |
if ((logwindow->qsos) - step != atoi (nr)) |
2170 |
dupe[3] = g_strdup(gmt); |
{ |
2171 |
gtk_clist_get_text(GTK_CLIST(logwindow->clist), row, CALL, &callsign); |
dupe[0] = g_strdup (logwindow->logname); |
2172 |
dupe[4] = g_strdup(callsign); |
dupe[1] = g_strdup (nr); |
2173 |
gtk_clist_get_text(GTK_CLIST(logwindow->clist), row, BAND, &band); |
gtk_clist_get_text (GTK_CLIST (logwindow->clist), row, |
2174 |
dupe[5] = g_strdup(band); |
DATE, &date); |
2175 |
gtk_clist_get_text(GTK_CLIST(logwindow->clist), row, MODE, &mode); |
dupe[2] = g_strdup (date); |
2176 |
dupe[6] = g_strdup(mode); |
gtk_clist_get_text (GTK_CLIST (logwindow->clist), row, |
2177 |
gtk_clist_append(GTK_CLIST(duperesultclist), dupe); |
GMT, &gmt); |
2178 |
dupefound = TRUE; |
dupe[3] = g_strdup (gmt); |
2179 |
} |
gtk_clist_get_text (GTK_CLIST (logwindow->clist), row, |
2180 |
} |
CALL, &callsign); |
2181 |
duperow++; |
dupe[4] = g_strdup (callsign); |
2182 |
} |
gtk_clist_get_text (GTK_CLIST (logwindow->clist), row, |
2183 |
} |
BAND, &band); |
2184 |
page++; |
dupe[5] = g_strdup (band); |
2185 |
} |
gtk_clist_get_text (GTK_CLIST (logwindow->clist), row, |
2186 |
|
MODE, &mode); |
2187 |
g_list_free(dupelist); |
dupe[6] = g_strdup (mode); |
2188 |
g_free(temp); |
gtk_clist_append (GTK_CLIST (duperesultclist), dupe); |
2189 |
for (i = 0; i < 7; i++) g_free(dupe[i]); |
dupefound = TRUE; |
2190 |
g_free(dupe); |
} |
|
|
|
|
/* show result */ |
|
|
gtk_widget_destroy(dupecheckdialog); |
|
|
if (dupefound) |
|
|
{ /* remove double entries (this happens with more than 2 dupes) */ |
|
|
for (row = 0 ; row < GTK_CLIST(duperesultclist)->rows; row++) |
|
|
{ |
|
|
gtk_clist_get_text(GTK_CLIST(duperesultclist), row, 0, &logn); |
|
|
gtk_clist_get_text(GTK_CLIST(duperesultclist), row, 1, &nr); |
|
|
if (row > 0) |
|
|
{ |
|
|
gtk_clist_get_text(GTK_CLIST(duperesultclist), row - 1, 0, &prevlogn); |
|
|
gtk_clist_get_text(GTK_CLIST(duperesultclist), row - 1, 1, &prevnr); |
|
|
if ((g_strcasecmp(prevnr, nr) == 0) && (g_strcasecmp(prevlogn, logn) == 0)) |
|
|
gtk_clist_remove(GTK_CLIST(duperesultclist), row - 1); |
|
|
} |
|
2191 |
} |
} |
2192 |
gtk_widget_show(dupelistdialog); |
duperow++; |
2193 |
gtk_widget_set_sensitive(mainwindow, 1); |
} |
2194 |
} |
} |
2195 |
else |
page++; |
2196 |
{ |
} |
2197 |
duperesultdialog = create_duperesultdialog(); |
|
2198 |
gtk_widget_destroy(dupelistdialog); |
g_list_free (dupelist); |
2199 |
gtk_widget_show(duperesultdialog); |
g_free (temp); |
2200 |
|
for (i = 0; i < 7; i++) |
2201 |
|
g_free (dupe[i]); |
2202 |
|
g_free (dupe); |
2203 |
|
|
2204 |
|
/* show result */ |
2205 |
|
gtk_widget_destroy (dupecheckdialog); |
2206 |
|
if (dupefound) |
2207 |
|
{ /* remove double entries (this happens with more than 2 dupes) */ |
2208 |
|
for (row = 0; row < GTK_CLIST (duperesultclist)->rows; row++) |
2209 |
|
{ |
2210 |
|
gtk_clist_get_text (GTK_CLIST (duperesultclist), row, 0, &logn); |
2211 |
|
gtk_clist_get_text (GTK_CLIST (duperesultclist), row, 1, &nr); |
2212 |
|
if (row > 0) |
2213 |
|
{ |
2214 |
|
gtk_clist_get_text (GTK_CLIST (duperesultclist), row - 1, 0, |
2215 |
|
&prevlogn); |
2216 |
|
gtk_clist_get_text (GTK_CLIST (duperesultclist), row - 1, 1, |
2217 |
|
&prevnr); |
2218 |
|
if ((g_strcasecmp (prevnr, nr) == 0) |
2219 |
|
&& (g_strcasecmp (prevlogn, logn) == 0)) |
2220 |
|
gtk_clist_remove (GTK_CLIST (duperesultclist), row - 1); |
2221 |
|
} |
2222 |
} |
} |
2223 |
|
gtk_widget_show (dupelistdialog); |
2224 |
|
gtk_widget_set_sensitive (mainwindow, 1); |
2225 |
|
} |
2226 |
|
else |
2227 |
|
{ |
2228 |
|
duperesultdialog = create_duperesultdialog (); |
2229 |
|
gtk_widget_destroy (dupelistdialog); |
2230 |
|
gtk_widget_show (duperesultdialog); |
2231 |
|
} |
2232 |
} |
} |
2233 |
|
|
2234 |
/* delete the dupecheck dialog */ |
/* delete the dupecheck dialog */ |
2235 |
gboolean on_dupecheckdialog_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) |
gboolean |
2236 |
|
on_dupecheckdialog_delete_event (GtkWidget * widget, GdkEvent * event, |
2237 |
|
gpointer user_data) |
2238 |
{ |
{ |
2239 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
2240 |
return FALSE; |
return FALSE; |
2241 |
} |
} |
2242 |
|
|
2243 |
/* cancel dupe check */ |
/* cancel dupe check */ |
2244 |
void on_dupecheckcancelbutton_clicked(GtkButton *button, gpointer user_data) |
void |
2245 |
|
on_dupecheckcancelbutton_clicked (GtkButton * button, gpointer user_data) |
2246 |
{ |
{ |
2247 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
2248 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
2249 |
} |
} |
2250 |
|
|
2251 |
|
|
2252 |
/* DUPE LIST DIALOG */ |
/* DUPE LIST DIALOG */ |
2253 |
void on_dupelistokbutton_clicked(GtkButton *button, gpointer user_data) |
void |
2254 |
|
on_dupelistokbutton_clicked (GtkButton * button, gpointer user_data) |
2255 |
{ |
{ |
2256 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
2257 |
} |
} |
2258 |
|
|
2259 |
/* entry is selected in the duperesult list, select corresponding entry in |
/* entry is selected in the duperesult list, select corresponding entry in |
2260 |
the main log */ |
the main log */ |
2261 |
void on_duperesultclist_select_row(GtkCList *clist, gint row, gint column, |
void |
2262 |
GdkEvent *event, gpointer user_data) |
on_duperesultclist_select_row (GtkCList * clist, gint row, gint column, |
2263 |
{ |
GdkEvent * event, gpointer user_data) |
2264 |
gchar *nr, *lognr, *logn; |
{ |
2265 |
gint i, logrow = -1; |
gchar *nr, *lognr, *logn; |
2266 |
logtype *logwindow = NULL; |
gint i, logrow = -1; |
2267 |
gboolean qsofound = FALSE; |
logtype *logwindow = NULL; |
2268 |
|
gboolean qsofound = FALSE; |
2269 |
gtk_clist_get_text(GTK_CLIST(clist), row, 1, &nr); |
|
2270 |
gtk_clist_get_text(GTK_CLIST(clist), row, 0, &logn); |
gtk_clist_get_text (GTK_CLIST (clist), row, 1, &nr); |
2271 |
|
gtk_clist_get_text (GTK_CLIST (clist), row, 0, &logn); |
2272 |
for (i = 0; i < g_list_length(logwindowlist); i++) |
|
2273 |
{ |
for (i = 0; i < g_list_length (logwindowlist); i++) |
2274 |
logwindow = g_list_nth_data(logwindowlist, i); |
{ |
2275 |
for (logrow = 0; logrow < logwindow->qsos; logrow++) |
logwindow = g_list_nth_data (logwindowlist, i); |
2276 |
{ |
for (logrow = 0; logrow < logwindow->qsos; logrow++) |
2277 |
gtk_clist_get_text(GTK_CLIST(logwindow->clist), logrow, 0, &lognr); |
{ |
2278 |
if ((g_strcasecmp(nr, lognr) == 0) && (g_strcasecmp(logn, logwindow->logname) == 0)) |
gtk_clist_get_text (GTK_CLIST (logwindow->clist), logrow, 0, |
2279 |
{ |
&lognr); |
2280 |
qsofound = TRUE; |
if ((g_strcasecmp (nr, lognr) == 0) |
2281 |
break; |
&& (g_strcasecmp (logn, logwindow->logname) == 0)) |
2282 |
} |
{ |
2283 |
} |
qsofound = TRUE; |
2284 |
if (qsofound) break; |
break; |
2285 |
} |
} |
|
if (qsofound) |
|
|
{ |
|
|
gtk_notebook_set_page(GTK_NOTEBOOK(mainnotebook), i); |
|
|
gtk_clist_moveto(GTK_CLIST(logwindow->clist), logrow, 0, 0.5, 0); |
|
|
gtk_clist_select_row(GTK_CLIST(logwindow->clist), logrow, 0); |
|
2286 |
} |
} |
2287 |
|
if (qsofound) |
2288 |
|
break; |
2289 |
|
} |
2290 |
|
if (qsofound) |
2291 |
|
{ |
2292 |
|
gtk_notebook_set_page (GTK_NOTEBOOK (mainnotebook), i); |
2293 |
|
gtk_clist_moveto (GTK_CLIST (logwindow->clist), logrow, 0, 0.5, 0); |
2294 |
|
gtk_clist_select_row (GTK_CLIST (logwindow->clist), logrow, 0); |
2295 |
|
} |
2296 |
} |
} |
2297 |
|
|
2298 |
|
|
2299 |
/* DUPE RESULT DIALOG */ |
/* DUPE RESULT DIALOG */ |
2300 |
void on_duperesultdialogokbutton_clicked(GtkButton *button, gpointer user_data) |
void |
2301 |
|
on_duperesultdialogokbutton_clicked (GtkButton * button, gpointer user_data) |
2302 |
{ |
{ |
2303 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
2304 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
2305 |
} |
} |
2306 |
|
|
2307 |
/* delete the duperesult dialog */ |
/* delete the duperesult dialog */ |
2308 |
gboolean on_duperesultdialog_delete_event(GtkWidget *widget, GdkEvent *event, |
gboolean |
2309 |
gpointer user_data) |
on_duperesultdialog_delete_event (GtkWidget * widget, GdkEvent * event, |
2310 |
|
gpointer user_data) |
2311 |
{ |
{ |
2312 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
2313 |
return FALSE; |
return FALSE; |
2314 |
} |
} |
2315 |
|
|
2316 |
|
|
2317 |
/* SAVE AS WARNING DIALOG */ |
/* SAVE AS WARNING DIALOG */ |
2318 |
gboolean on_savewarningdialog_delete_event(GtkWidget *widget, GdkEvent *event, |
gboolean |
2319 |
gpointer user_data) |
on_savewarningdialog_delete_event (GtkWidget * widget, GdkEvent * event, |
2320 |
|
gpointer user_data) |
2321 |
{ |
{ |
2322 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
2323 |
return FALSE; |
return FALSE; |
2324 |
} |
} |
2325 |
|
|
2326 |
|
|
2327 |
void on_savewarningokbutton_clicked(GtkButton *button, gpointer user_data) |
void |
2328 |
|
on_savewarningokbutton_clicked (GtkButton * button, gpointer user_data) |
2329 |
{ |
{ |
2330 |
gchar *temp; |
gchar *temp; |
2331 |
logtype *logwindow; |
logtype *logwindow; |
2332 |
|
|
2333 |
logwindow = g_list_nth_data(logwindowlist, |
logwindow = g_list_nth_data (logwindowlist, |
2334 |
gtk_notebook_get_current_page(GTK_NOTEBOOK(mainnotebook))); |
gtk_notebook_get_current_page (GTK_NOTEBOOK |
2335 |
savelog(logwindow, globtemp, globtype); |
(mainnotebook))); |
2336 |
temp = g_strdup_printf(_("Log saved to %s"), globtemp); |
savelog (logwindow, globtemp, globtype); |
2337 |
update_statusbar(temp); |
temp = g_strdup_printf (_("Log saved to %s"), globtemp); |
2338 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
update_statusbar (temp); |
2339 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
2340 |
|
gtk_widget_set_sensitive (mainwindow, 1); |
2341 |
} |
} |
2342 |
|
|
2343 |
|
|
2344 |
void on_savewarningcancelbutton_clicked(GtkButton *button, gpointer user_data) |
void |
2345 |
|
on_savewarningcancelbutton_clicked (GtkButton * button, gpointer user_data) |
2346 |
{ |
{ |
2347 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
2348 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
2349 |
} |
} |
2350 |
|
|
2351 |
|
|
2352 |
/* DEFAULTS DIALOG */ |
/* DEFAULTS DIALOG */ |
2353 |
|
|
2354 |
gboolean on_defaultsdialog_delete_event(GtkWidget *widget, GdkEvent *event, |
gboolean |
2355 |
gpointer user_data) |
on_defaultsdialog_delete_event (GtkWidget * widget, GdkEvent * event, |
2356 |
{ |
gpointer user_data) |
2357 |
gtk_widget_set_sensitive(mainwindow, 1); |
{ |
2358 |
return FALSE; |
gtk_widget_set_sensitive (mainwindow, 1); |
2359 |
} |
return FALSE; |
2360 |
|
} |
2361 |
|
|
2362 |
void on_defaultsokbutton_clicked(GtkButton *button, gpointer user_data) |
|
2363 |
{ |
void |
2364 |
GtkWidget *defaultsmhzentry, *defaultsmodeentry, *defaultstxrstentry, |
on_defaultsokbutton_clicked (GtkButton * button, gpointer user_data) |
2365 |
*defaultsrxrstentry, *defaultspowerentry, *defaultsdialog, |
{ |
2366 |
*defaultsfreefield1entry, *defaultsfreefield2entry, |
GtkWidget *defaultsmhzentry, *defaultsmodeentry, *defaultstxrstentry, |
2367 |
*defaultsremarksentry; |
*defaultsrxrstentry, *defaultspowerentry, *defaultsdialog, |
2368 |
gchar *temp; |
*defaultsfreefield1entry, *defaultsfreefield2entry, *defaultsremarksentry; |
2369 |
|
gchar *temp; |
2370 |
defaultsdialog = gtk_widget_get_toplevel(GTK_WIDGET(button)); |
|
2371 |
defaultsmhzentry = lookup_widget(defaultsdialog, "defaultsmhzentry"); |
defaultsdialog = gtk_widget_get_toplevel (GTK_WIDGET (button)); |
2372 |
defaultsmodeentry = lookup_widget(defaultsdialog, "defaultsmodeentry"); |
defaultsmhzentry = lookup_widget (defaultsdialog, "defaultsmhzentry"); |
2373 |
defaultstxrstentry = lookup_widget(defaultsdialog, "defaultstxrstentry"); |
defaultsmodeentry = lookup_widget (defaultsdialog, "defaultsmodeentry"); |
2374 |
defaultsrxrstentry = lookup_widget(defaultsdialog, "defaultsrxrstentry"); |
defaultstxrstentry = lookup_widget (defaultsdialog, "defaultstxrstentry"); |
2375 |
defaultspowerentry = lookup_widget(defaultsdialog, "defaultspowerentry"); |
defaultsrxrstentry = lookup_widget (defaultsdialog, "defaultsrxrstentry"); |
2376 |
defaultsfreefield1entry = lookup_widget(defaultsdialog, "defaultsfreefield1entry"); |
defaultspowerentry = lookup_widget (defaultsdialog, "defaultspowerentry"); |
2377 |
defaultsfreefield2entry = lookup_widget(defaultsdialog, "defaultsfreefield2entry"); |
defaultsfreefield1entry = |
2378 |
defaultsremarksentry = lookup_widget(defaultsdialog, "defaultsremarksentry"); |
lookup_widget (defaultsdialog, "defaultsfreefield1entry"); |
2379 |
|
defaultsfreefield2entry = |
2380 |
temp = gtk_editable_get_chars(GTK_EDITABLE(defaultsmhzentry), 0, -1); |
lookup_widget (defaultsdialog, "defaultsfreefield2entry"); |
2381 |
if (strlen(temp) == 0) preferences.defaultmhz = g_strdup("?"); |
defaultsremarksentry = |
2382 |
else if (g_strcasecmp(preferences.defaultmhz, temp)) |
lookup_widget (defaultsdialog, "defaultsremarksentry"); |
2383 |
preferences.defaultmhz = g_strdup(temp); |
|
2384 |
temp = gtk_editable_get_chars(GTK_EDITABLE(defaultsmodeentry), 0, -1); |
temp = gtk_editable_get_chars (GTK_EDITABLE (defaultsmhzentry), 0, -1); |
2385 |
if (strlen(temp) == 0) preferences.defaultmode = g_strdup("?"); |
if (strlen (temp) == 0) |
2386 |
else if (g_strcasecmp(preferences.defaultmode, temp)) |
preferences.defaultmhz = g_strdup ("?"); |
2387 |
preferences.defaultmode = g_strdup(temp); |
else if (g_strcasecmp (preferences.defaultmhz, temp)) |
2388 |
temp = gtk_editable_get_chars(GTK_EDITABLE(defaultstxrstentry), 0, -1); |
preferences.defaultmhz = g_strdup (temp); |
2389 |
if (strlen(temp) == 0) preferences.defaulttxrst = g_strdup("?"); |
temp = gtk_editable_get_chars (GTK_EDITABLE (defaultsmodeentry), 0, -1); |
2390 |
else if (g_strcasecmp(preferences.defaulttxrst, temp)) |
if (strlen (temp) == 0) |
2391 |
preferences.defaulttxrst = g_strdup(temp); |
preferences.defaultmode = g_strdup ("?"); |
2392 |
temp = gtk_editable_get_chars(GTK_EDITABLE(defaultsrxrstentry), 0, -1); |
else if (g_strcasecmp (preferences.defaultmode, temp)) |
2393 |
if (strlen(temp) == 0) preferences.defaultrxrst = g_strdup("?"); |
preferences.defaultmode = g_strdup (temp); |
2394 |
else if (g_strcasecmp(preferences.defaultrxrst, temp)) |
temp = gtk_editable_get_chars (GTK_EDITABLE (defaultstxrstentry), 0, -1); |
2395 |
preferences.defaultrxrst = g_strdup(temp); |
if (strlen (temp) == 0) |
2396 |
temp = gtk_editable_get_chars(GTK_EDITABLE(defaultspowerentry), 0, -1); |
preferences.defaulttxrst = g_strdup ("?"); |
2397 |
if (strlen(temp) == 0) preferences.defaultpower = g_strdup("?"); |
else if (g_strcasecmp (preferences.defaulttxrst, temp)) |
2398 |
else if (g_strcasecmp(preferences.defaultpower, temp)) |
preferences.defaulttxrst = g_strdup (temp); |
2399 |
preferences.defaultpower = g_strdup(temp); |
temp = gtk_editable_get_chars (GTK_EDITABLE (defaultsrxrstentry), 0, -1); |
2400 |
temp = gtk_editable_get_chars(GTK_EDITABLE(defaultsfreefield1entry), 0, -1); |
if (strlen (temp) == 0) |
2401 |
if (strlen(temp) == 0) preferences.defaultfreefield1 = g_strdup("?"); |
preferences.defaultrxrst = g_strdup ("?"); |
2402 |
else if (g_strcasecmp(preferences.defaultfreefield1, temp)) |
else if (g_strcasecmp (preferences.defaultrxrst, temp)) |
2403 |
preferences.defaultfreefield1 = g_strdup(temp); |
preferences.defaultrxrst = g_strdup (temp); |
2404 |
temp = gtk_editable_get_chars(GTK_EDITABLE(defaultsfreefield2entry), 0, -1); |
temp = gtk_editable_get_chars (GTK_EDITABLE (defaultspowerentry), 0, -1); |
2405 |
if (strlen(temp) == 0) preferences.defaultfreefield2 = g_strdup("?"); |
if (strlen (temp) == 0) |
2406 |
else if (g_strcasecmp(preferences.defaultfreefield2, temp)) |
preferences.defaultpower = g_strdup ("?"); |
2407 |
preferences.defaultfreefield2 = g_strdup(temp); |
else if (g_strcasecmp (preferences.defaultpower, temp)) |
2408 |
temp = gtk_editable_get_chars(GTK_EDITABLE(defaultsremarksentry), 0, -1); |
preferences.defaultpower = g_strdup (temp); |
2409 |
if (strlen(temp) == 0) preferences.defaultremarks = g_strdup("?"); |
temp = |
2410 |
else if (g_strcasecmp(preferences.defaultremarks, temp)) |
gtk_editable_get_chars (GTK_EDITABLE (defaultsfreefield1entry), 0, -1); |
2411 |
preferences.defaultremarks = g_strdup(temp); |
if (strlen (temp) == 0) |
2412 |
|
preferences.defaultfreefield1 = g_strdup ("?"); |
2413 |
g_free(temp); |
else if (g_strcasecmp (preferences.defaultfreefield1, temp)) |
2414 |
gtk_widget_destroy(defaultsdialog); |
preferences.defaultfreefield1 = g_strdup (temp); |
2415 |
gtk_widget_set_sensitive(mainwindow, 1); |
temp = |
2416 |
|
gtk_editable_get_chars (GTK_EDITABLE (defaultsfreefield2entry), 0, -1); |
2417 |
|
if (strlen (temp) == 0) |
2418 |
|
preferences.defaultfreefield2 = g_strdup ("?"); |
2419 |
|
else if (g_strcasecmp (preferences.defaultfreefield2, temp)) |
2420 |
|
preferences.defaultfreefield2 = g_strdup (temp); |
2421 |
|
temp = gtk_editable_get_chars (GTK_EDITABLE (defaultsremarksentry), 0, -1); |
2422 |
|
if (strlen (temp) == 0) |
2423 |
|
preferences.defaultremarks = g_strdup ("?"); |
2424 |
|
else if (g_strcasecmp (preferences.defaultremarks, temp)) |
2425 |
|
preferences.defaultremarks = g_strdup (temp); |
2426 |
|
|
2427 |
|
g_free (temp); |
2428 |
|
gtk_widget_destroy (defaultsdialog); |
2429 |
|
gtk_widget_set_sensitive (mainwindow, 1); |
2430 |
} |
} |
2431 |
|
|
2432 |
|
|
2433 |
void on_defaultscancelbutton_clicked(GtkButton *button, gpointer user_data) |
void |
2434 |
|
on_defaultscancelbutton_clicked (GtkButton * button, gpointer user_data) |
2435 |
{ |
{ |
2436 |
gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); |
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (button))); |
2437 |
gtk_widget_set_sensitive(mainwindow, 1); |
gtk_widget_set_sensitive (mainwindow, 1); |
2438 |
} |
} |
2439 |
|
|
2440 |
/* WORKED B4 DIALOG */ |
/* WORKED B4 DIALOG */ |
2441 |
|
|
2442 |
void on_b4clist_select_row(GtkCList *clist, gint row, gint column, |
void |
2443 |
GdkEvent *event, gpointer user_data) |
on_b4clist_select_row (GtkCList * clist, gint row, gint column, |
2444 |
|
GdkEvent * event, gpointer user_data) |
2445 |
{ |
{ |
2446 |
|
|
2447 |
} |
} |
2448 |
|
|
2449 |
void on_b4okbutton_clicked(GtkButton *button, gpointer user_data) |
void |
2450 |
|
on_b4okbutton_clicked (GtkButton * button, gpointer user_data) |
2451 |
{ |
{ |
2452 |
gtk_widget_hide(b4dialog); |
gtk_widget_hide (b4dialog); |
2453 |
} |
} |
2454 |
|
|
2455 |
/* end of file */ |
/* end of file */ |