2
ACfax - Fax reception with X11-interface for amateur radio
3
Copyright (C) 1995-1998 Andreas Czechanowski, DL4SDC
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software Foundation,
17
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
andreas.czechanowski@ins.uni-stuttgart.de
23
* acfax.c - the main program
29
#include <X11/Intrinsic.h>
30
#include <X11/StringDefs.h>
31
#include <X11/Shell.h>
33
#include <X11/Xaw3d/ThreeD.h>
34
#include <X11/Xaw3d/Form.h>
35
#include <X11/Xaw3d/MenuButton.h>
36
#include <X11/Xaw3d/Toggle.h>
37
#include <X11/Xaw3d/Viewport.h>
38
#include <X11/Xaw3d/Box.h>
39
#include <X11/Xaw3d/SimpleMenu.h>
40
#include <X11/Xaw3d/SmeBSB.h>
41
#include <X11/Xaw3d/AsciiText.h>
43
#include <X11/Xaw/Form.h>
44
#include <X11/Xaw/MenuButton.h>
45
#include <X11/Xaw/Toggle.h>
46
#include <X11/Xaw/Viewport.h>
47
#include <X11/Xaw/Box.h>
48
#include <X11/Xaw/SimpleMenu.h>
49
#include <X11/Xaw/SmeBSB.h>
50
#include <X11/Xaw/AsciiText.h>
54
#include "mod_demod.h"
57
#include "fax_funcs.h"
60
static char *fallbacks[] = {
61
"*background: grey80",
63
"*menuform*filebut.label: file-ops",
64
"*menuform*filebut*file_mw.label: Image-file ops :",
65
"*menuform*filebut*autosave.label: save (auto filename)",
66
"*menuform*filebut*saveas.label: save as...",
67
"*menuform*filebut*close.label: close savefile",
68
"*menuform*filebut*quit.label: quit ACfax",
69
"*optbut.label: Options...",
70
"*modebut.label: Modes...",
71
/* "*msg_shell*msg_ok.label: -OK-", */
72
"*canvas.width: 1280",
73
"*canvas.height: 1024",
74
"*modemform*modemdesc.background: beige",
75
"*modemform*modemdesc.label: modem settings",
76
"*modemform*modinfo.background: beige",
77
"*modemform*modinfo.label: modem\\ntype",
78
"*modemform*filinfo.background: beige",
79
"*modemform*filinfo.label: filter\\nselect",
80
"*modemform*mflt1.label: narrow filter",
81
"*modemform*mflt2.label: middle filter",
82
"*modemform*mflt3.label: wide filter",
83
"*modemform*fmdevinfo.background: beige",
84
"*modemform*fmdevinfo.label: FM deviation (+/- Hz)",
85
"*modemform*siginfo.background: beige",
86
"*modemform*siginfo.label: Signal",
87
"*faxctrls*runinfo.background: beige",
88
"*faxctrls*runinfo.label: operation\\ncontrol",
89
"*faxctrls*dirinfo.background: beige",
90
"*faxctrls*dirinfo.label: writing\\ndirection",
91
"*faxctrls*polinfo.background: beige",
92
"*faxctrls*polinfo.label: image\\npolarity",
93
"*faxctrls*phsinfo.background: beige",
94
"*faxctrls*phsinfo.label: sync\\npolarity",
95
"*faxctrls*adjinfo.background: beige",
96
"*faxctrls*adjinfo.label: image\\nadjust",
97
"*faxparams*numinfo.background: beige",
98
"*faxparams*numinfo.label: numeric FAX-parameters",
99
"*faxparams*statxt.label: APT start:",
100
"*faxparams*stotxt.label: stop:",
101
"*faxparams*lpmtxt.label: LPM:",
102
"*faxparams*ioctxt.label: IOC:",
111
Display *dpy; /* the X-Display to use */
112
Screen *scr; /* screen of the display */
113
Pixmap cpxmap; /* The "backing store" for the canvas-widget */
114
GC cgc; /* GC for XPutImage from horimage/verimage to cpxmap */
115
/* XEvent event; for XtAppNextEvent / XtDispatchEvent */
116
/* unsigned canwid; width of canvas-widget */
117
/* unsigned canhei; height of canvas-widget */
118
/* Colormap cmap, rootcmap; colormap we use, and default-colormap */
119
/* unsigned coltab[256]; mapping table linear grayscale->pixel-value */
120
/* char cused[256]; table indicating used pixel-values */
121
int mode_lock = 0; /* locks the operation control callback */
122
/* int xpos, ypos; position to fill with data */
123
/* int ixoc; number of pixels of one scan-line / PI */
124
/* int right2left; boolean indicating reverse line writing direction */
125
/* int bot2top; boolean indicating reverse line stacking direction */
126
/* int mod_mode; can be MOD_FM or MOD_AM */
127
/* int fax_state; one of FAX_APT, FAX_PHAS or FAX_RX */
128
/* int max_val; maximum level for demodulated output */
129
/* int aptstart; possible APT start values */
130
/* int aptstop; possible APT stop values */
131
int save_width; /* width of scan-line in pixels for saving */
132
struct fileshell_args save_fsa; /* structure for file-save */
133
struct fileshell_args load_fsa; /* structure for file-load */
135
XtAppContext mainapp;
138
Widget last; / just for convenience.... /
139
Widget form, / where to put it all in /
140
vport, / a viewport to look thru onto the canvas /
141
canvas; / widget holding picture using XImages /
145
filebut, / buttons in the top-line : "file" /
146
modebut, / mode-select button /
147
optbut; / option-select button /
148
Widget file_mw, / popup-menu for "file" /
149
file_saveas, / menu-item "save as" /
150
file_close, / menu-item "close savefile" /
151
file_autosave; / menu-item "save (auto filename) /
152
Widget msg_shell, / popup-shell for aux. messages /
153
msg_form, / form widget holding... /
154
msg_text, / displayed text /
155
msg_ok; / additional button (Ok/cancel/confirm/...) /
214
#define elofs(element) XtOffsetOf(struct prginfo, element)
216
static XtResource resources[] = {
217
{ "callsign", "Callsign", XtRString, sizeof(String),
218
elofs(callsign), XtRImmediate, (XtPointer)"nocall" },
219
{ "size", "Size", XtRString, sizeof(String),
220
elofs(sizedesc), XtRImmediate, (XtPointer)"double" },
223
static XrmOptionDescRec options[] = {
224
{ "-callsign", ".callsign", XrmoptionSepArg, (XtPointer)NULL },
225
{ "-size", ".size", XrmoptionSepArg, (XtPointer)NULL },
228
static void usage(char *);
229
/* void create_widgets(void); */
230
/* void create_pixmaps(Widget); */
231
void update_pxm(XImage *, int, int, int, int, unsigned, unsigned);
232
void num_input(Widget, XEvent *, String *, Cardinal *);
233
void show_values(void);
234
void op_changed(int);
235
void modmode_cb(Widget, XtPointer, XtPointer);
236
void filtsel_cb(Widget, XtPointer, XtPointer);
237
void stastop_cb(Widget, XtPointer, XtPointer);
238
void dirhv_cb(Widget, XtPointer, XtPointer);
239
void dirlr_cb(Widget, XtPointer, XtPointer);
240
void dirtb_cb(Widget, XtPointer, XtPointer);
241
void norinv_cb(Widget, XtPointer, XtPointer);
242
void posneg_cb(Widget, XtPointer, XtPointer);
243
void lshift_cb(Widget, XtPointer, XtPointer);
244
void lshift_trigger(Widget, XtPointer, XtPointer);
245
void azimut_cb(Widget, XtPointer, XtPointer);
246
void azimut_trigger(Widget, XtPointer, XtPointer);
247
void namesave_cb(Widget, XtPointer, XtPointer);
248
void savefile_act(char *);
249
void autosave_cb(Widget, XtPointer, XtPointer);
250
void closesave_cb(Widget, XtPointer, XtPointer);
251
void quit_cb(Widget, XtPointer, XtPointer);
253
XtTranslations txt_trans;
254
XtActionsRec acts[] = {
255
{ "num-in", (XtActionProc)num_input },
259
/* simple, fast integer to string conversion */
266
d = 0; /* 0 digits */
267
p = 0; /* 0 chars in string */
268
/* allow to handle negative numbers */
273
/* calculate all the fractional parts */
280
/* concatenate to string in reverse order */
282
res[p++] = f[--d] + '0';
285
/* terminate string */
292
static void usage(char *prgname)
294
fprintf(stderr, "Usage : %s [Options]\n"
295
" Known options are :\n"
296
" -callsign callsign\n"
297
" -width {normal|double}\n", prgname);
301
void create_pixmaps(Widget wid)
303
#include "bitmaps/horiz.bit"
304
#include "bitmaps/vert.bit"
305
#include "bitmaps/left.bit"
306
#include "bitmaps/right.bit"
307
#include "bitmaps/top.bit"
308
#include "bitmaps/bottom.bit"
309
#include "bitmaps/nphs.bit"
310
#include "bitmaps/iphs.bit"
311
#include "bitmaps/normal.bit"
312
#include "bitmaps/invers.bit"
313
#include "bitmaps/azimut.bit"
314
#include "bitmaps/shift.bit"
315
#include "bitmaps/stop.bit"
316
#include "bitmaps/syn.bit"
317
#include "bitmaps/run.bit"
318
#include "bitmaps/ammod.bit"
319
#include "bitmaps/fmmod.bit"
320
#include "bitmaps/narrow.bit"
321
#include "bitmaps/middle.bit"
322
#include "bitmaps/wide.bit"
326
px_horiz = XCreateBitmapFromData(dpy, win, horiz_bits, horiz_width, horiz_height);
327
px_vert = XCreateBitmapFromData(dpy, win, vert_bits, vert_width, vert_height);
328
px_right = XCreateBitmapFromData(dpy, win, right_bits, right_width, right_height);
329
px_left = XCreateBitmapFromData(dpy, win, left_bits, left_width, left_height);
330
px_top = XCreateBitmapFromData(dpy, win, top_bits, top_width, top_height);
331
px_bottom = XCreateBitmapFromData(dpy, win, bottom_bits, bottom_width, bottom_height);
332
px_nphs = XCreateBitmapFromData(dpy, win, nphs_bits, nphs_width, nphs_height);
333
px_iphs = XCreateBitmapFromData(dpy, win, iphs_bits, iphs_width, iphs_height);
334
px_normal = XCreateBitmapFromData(dpy, win, normal_bits, normal_width, normal_height);
335
px_invers = XCreateBitmapFromData(dpy, win, invers_bits, invers_width, invers_height);
336
px_azimut = XCreateBitmapFromData(dpy, win, azimut_bits, azimut_width, azimut_height);
337
px_shift = XCreateBitmapFromData(dpy, win, shift_bits, shift_width, shift_height);
338
px_stop = XCreateBitmapFromData(dpy, win, stop_bits, stop_width, stop_height);
339
px_syn = XCreateBitmapFromData(dpy, win, syn_bits, syn_width, syn_height);
340
px_run = XCreateBitmapFromData(dpy, win, run_bits, run_width, run_height);
341
px_mam = XCreateBitmapFromData(dpy, win, ammod_bits, ammod_width, ammod_height);
342
px_mfm = XCreateBitmapFromData(dpy, win, fmmod_bits, fmmod_width, fmmod_height);
343
px_narrow = XCreateBitmapFromData(dpy, win, narrow_bits, narrow_width, narrow_height);
344
px_middle = XCreateBitmapFromData(dpy, win, middle_bits, middle_width, middle_height);
345
px_wide = XCreateBitmapFromData(dpy, win, wide_bits, wide_width, wide_height);
347
XtVaSetValues(dirhv, XtNbitmap, px_horiz, NULL);
348
XtVaSetValues(dirlr, XtNbitmap, px_right, NULL);
349
XtVaSetValues(dirtb, XtNbitmap, px_bottom, NULL);
350
XtVaSetValues(norinv, XtNbitmap, px_normal, NULL);
351
XtVaSetValues(posneg, XtNbitmap, px_nphs, NULL);
352
XtVaSetValues(lshift, XtNbitmap, px_shift, NULL);
353
XtVaSetValues(azimut, XtNbitmap, px_azimut, NULL);
354
XtVaSetValues(rmstop, XtNbitmap, px_stop, NULL);
355
XtVaSetValues(rmsyn, XtNbitmap, px_syn, NULL);
356
XtVaSetValues(rmrun, XtNbitmap, px_run, NULL);
357
XtVaSetValues(mmode, XtNbitmap, px_mfm, NULL);
358
XtVaSetValues(mfilter, XtNbitmap, px_middle, NULL);
362
/* copy one of the XImages into the Pixmap of the canvas, and redisplay that
365
void update_pxm(XImage *img, int xs, int ys, int xd, int yd,
366
unsigned wid, unsigned hei)
368
XPutImage(dpy, cpxmap, cgc, img, xs, ys, xd, yd, wid, hei);
369
canvasUpdateArea((CanvasWidget)canvas, xd, yd, wid, hei);
372
/* the following makes the gcc happy not to complain about unused arguments */
374
void num_input(Widget w, XEvent *event, String *par, Cardinal *npar)
380
XtVaGetValues(w, XtNstring, &str, NULL);
382
if (w == num_s.staval) {
383
if (val > 500) val = 500;
384
if (val < 100) val = 100;
386
} else if (w == num_s.stoval) {
387
if (val > 500) val = 500;
388
if (val < 100) val = 100;
390
} else if (w == num_s.lpmval) {
391
setup_fax(val, 0, 0, w, 0, 0, 0, 0);
393
} else if (w == num_s.iocval) {
394
setup_fax(0, val, 0, w, 0, 0, 0, 0);
396
} else if (w == mod_s.fmdevval) {
397
setup_fax(0, 0, 0, w, 0, 0, val, 0);
400
sprintf(ch, "%d", val);
401
XtVaSetValues(w, XtNstring, ch, NULL);
404
/* show the numeric fax-parameters and the FM-deviation of the modem */
405
void show_values(void)
407
XtVaSetValues(mod_s.fmdevval, XtNstring, ltoa(devi), NULL);
408
XtVaSetValues(num_s.lpmval, XtNstring, ltoa(lpm), NULL);
409
XtVaSetValues(num_s.iocval, XtNstring, ltoa(ixoc), NULL);
410
XtVaSetValues(num_s.staval, XtNstring, ltoa(aptstart), NULL);
411
XtVaSetValues(num_s.stoval, XtNstring, ltoa(aptstop), NULL);
414
void op_changed(int mode)
419
XtVaSetValues(run_s.rmstop, XtNstate, True, NULL);
422
XtVaSetValues(run_s.rmsyn, XtNstate, True, NULL);
425
XtVaSetValues(run_s.rmrun, XtNstate, True, NULL);
431
void modmode_cb(Widget w, XtPointer client_data, XtPointer call_data)
435
st = (Boolean)((long)call_data);
437
setup_fax(0, 0, 0, w, 0, 0, 0, MOD_AM);
438
XtVaSetValues(mod_s.mmode, XtNbitmap, px_mam, NULL);
440
setup_fax(0, 0, 0, w, 0, 0, 0, MOD_FM);
441
XtVaSetValues(mod_s.mmode, XtNbitmap, px_mfm, NULL);
445
void filtsel_cb(Widget w, XtPointer client_data, XtPointer call_data)
450
selectn = (int)client_data;
464
setup_fax(0, 0, 0, w, 0, 0, 0, selectn);
465
XtVaSetValues(mod_s.mfilter, XtNbitmap, pxm, NULL);
468
void stastop_cb(Widget w, XtPointer client_data, XtPointer call_data)
473
rd = (unsigned)XawToggleGetCurrent(w);
474
st = (Boolean)((long)call_data);
475
fprintf(stderr, "rd = %u, st = %u\n", rd, (unsigned)st);
476
if (rd == 0) { /* all widgets of the radio-group are unset ? */
477
/* XtVaSetValues(rmstop, XtNstate, True, NULL); we may call ourself here ! */
481
return; /* if unset, do not continue */
483
if (mode_lock) return;
497
void syn_cb(Widget w, XtPointer client_data, XtPointer call_data)
501
st = (Boolean)((long)call_data);
503
XtVaSetValues(w, XtNstate, True, NULL); /* we may call ourself here ! */
504
return; /* if unset, do not continue */
509
void run_cb(Widget w, XtPointer client_data, XtPointer call_data)
513
st = (Boolean)((long)call_data);
515
XtVaSetValues(w, XtNstate, True, NULL); /* we may call ourself here ! */
516
return; /* if unset, do not continue */
521
void dirhv_cb(Widget w, XtPointer client_data, XtPointer call_data)
525
XtVaGetValues(w, XtNstate, &st, NULL);
527
setup_fax(0, 0, FAX_VER, w, 0, 0, 0, 0);
528
XtVaSetValues(w, XtNbitmap, px_vert, NULL);
530
setup_fax(0, 0, FAX_HOR, w, 0, 0, 0, 0);
531
XtVaSetValues(w, XtNbitmap, px_horiz, NULL);
535
void dirlr_cb(Widget w, XtPointer client_data, XtPointer call_data)
539
XtVaGetValues(w, XtNstate, &st, NULL);
541
setup_fax(0, 0, FAX_RIG2LEF, w, 0, 0, 0, 0);
542
XtVaSetValues(w, XtNbitmap, px_left, NULL);
544
setup_fax(0, 0, FAX_LEF2RIG, w, 0, 0, 0, 0);
545
XtVaSetValues(w, XtNbitmap, px_right, NULL);
549
void dirtb_cb(Widget w, XtPointer client_data, XtPointer call_data)
553
XtVaGetValues(w, XtNstate, &st, NULL);
555
setup_fax(0, 0, FAX_BOT2TOP, w, 0, 0, 0, 0);
556
XtVaSetValues(w, XtNbitmap, px_top, NULL);
558
setup_fax(0, 0, FAX_TOP2BOT, w, 0, 0, 0, 0);
559
XtVaSetValues(w, XtNbitmap, px_bottom, NULL);
563
void norinv_cb(Widget w, XtPointer client_data, XtPointer call_data)
567
XtVaGetValues(w, XtNstate, &st, NULL);
569
setup_fax(0, 0, FAX_CINV, w, 0, 0, 0, 0);
570
XtVaSetValues(w, XtNbitmap, px_invers, NULL);
572
setup_fax(0, 0, FAX_CNOR, w, 0, 0, 0, 0);
573
XtVaSetValues(w, XtNbitmap, px_normal, NULL);
577
void posneg_cb(Widget w, XtPointer client_data, XtPointer call_data)
581
XtVaGetValues(w, XtNstate, &st, NULL);
583
setup_fax(0, 0, FAX_PWHT, w, 0, 0, 0, 0);
584
XtVaSetValues(w, XtNbitmap, px_iphs, NULL);
586
setup_fax(0, 0, FAX_PBLK, w, 0, 0, 0, 0);
587
XtVaSetValues(w, XtNbitmap, px_nphs, NULL);
591
void text_cb(Widget w, XtPointer client_data, XtPointer call_data)
595
XtVaGetValues(w, XtNstring, &s, NULL);
596
fprintf(stderr, "text_cb: string = %s\n", s);
599
void show_coords(Widget w, XtPointer client_data, XtPointer call_data)
603
xp = (XPoint *) call_data;
604
printf("coords = %d, %d\n", xp->x, xp->y);
608
void lshift_cb(Widget w, XtPointer client_data, XtPointer call_data)
610
XtVaSetValues(adj_s.lshift, XtNsensitive, False, NULL);
611
XtVaSetValues(adj_s.azimut, XtNsensitive, False, NULL);
612
XtVaSetValues(info_s.text, XtNlabel, "move mointer to sync position\n"
613
"and press left mouse button.", NULL);
614
XtVaSetValues(info_s.butn, XtNlabel, "Cancel", NULL);
615
XawFormDoLayout(info_s.form, True);
616
XtAddCallback(canvas, XtNcallback, lshift_trigger, (XtPointer) 1);
617
XtAddCallback(info_s.butn, XtNcallback, lshift_trigger, (XtPointer) 0);
618
XtPopup(info_s.shell, XtGrabNone);
621
void lshift_trigger(Widget w, XtPointer client_data, XtPointer call_data)
625
if ((unsigned)client_data == 1) {
627
xp = (XPoint *) call_data;
628
shift_fax_coords(xp->x, xp->y);
631
XtRemoveAllCallbacks(canvas, XtNcallback);
632
XtVaSetValues(adj_s.lshift, XtNsensitive, True, NULL);
633
XtVaSetValues(adj_s.azimut, XtNsensitive, True, NULL);
634
XtPopdown(info_s.shell);
637
void azimut_cb(Widget w, XtPointer client_data, XtPointer call_data)
642
/* do not allow any further keypress on this button */
643
XtVaSetValues(adj_s.azimut, XtNsensitive, False, NULL);
644
XtVaSetValues(adj_s.lshift, XtNsensitive, False, NULL);
645
XtVaGetValues(dir_s.dirhv, XtNstate, &vertmode, NULL);
646
sprintf(message, "move mointer to the first point\n"
647
"on a line that should be %s\n"
648
"and press left mouse button.",
649
(vertmode) ? "horizontal" : "vertical");
650
XtVaSetValues(info_s.text, XtNlabel, message, NULL);
651
XtVaSetValues(info_s.butn, XtNlabel, "Cancel", NULL);
652
XawFormDoLayout(info_s.form, True);
653
XtAddCallback(canvas, XtNcallback, azimut_trigger, (XtPointer) 1);
654
XtAddCallback(info_s.butn, XtNcallback, azimut_trigger, (XtPointer) 0);
655
XtPopup(info_s.shell, XtGrabNone);
658
void azimut_trigger(Widget w, XtPointer client_data, XtPointer call_data)
663
if ((unsigned)client_data == 1) {
664
/* first point, get position into xa, ya */
666
xp = (XPoint *) call_data;
669
XtVaSetValues(info_s.text, XtNlabel, "now move pointer to the second point\n"
670
"on that line and press left mouse button.", NULL);
671
XtVaSetValues(info_s.butn, XtNlabel, "Cancel", NULL);
672
/* XawFormDoLayout(info_s.form, True); */
673
XtRemoveAllCallbacks(canvas, XtNcallback);
674
XtAddCallback(canvas, XtNcallback, azimut_trigger, (XtPointer) 2);
677
} else if ((unsigned)client_data == 2) {
678
/* second point, remove the menu from the screen */
679
XtRemoveAllCallbacks(canvas, XtNcallback);
681
xp = (XPoint *) call_data;
682
correct_fax_azimut(xp->x - xa, xp->y - ya);
685
/* remove callbacks from canvas, re-activate azimut and lshift buttons,
686
pop down the shell */
687
XtRemoveAllCallbacks(canvas, XtNcallback);
688
XtVaSetValues(adj_s.azimut, XtNsensitive, True, NULL);
689
XtVaSetValues(adj_s.lshift, XtNsensitive, True, NULL);
690
XtPopdown(info_s.shell);
693
void namesave_cb(Widget w, XtPointer client_data, XtPointer call_data)
695
query_filename(&save_fsa);
698
void savefile_act(char *name)
702
ret = save_faxfile(name, save_width);
705
simple_info("Save-file already open !\nClose this file first");
708
simple_info("Cannot open save-file ?!");
715
void autosave_cb(Widget w, XtPointer client_data, XtPointer call_data)
719
ret = save_faxfile(NULL, save_width);
722
simple_info("Save-file already open !\nClose this file first");
725
simple_info("Cannot open save-file ?!");
732
void closesave_cb(Widget w, XtPointer client_data, XtPointer call_data)
737
void quit_cb(Widget w, XtPointer client_data, XtPointer call_data)
742
void main(int argc, char **argv)
749
toplevel = XtAppInitialize(&mainapp, "ACfax",
750
options, XtNumber(options),
753
NULL, 0); /* no arguments-list, 0 arguments */
755
XtGetApplicationResources(toplevel, (XtPointer)&prg_info,
756
resources, XtNumber(resources),
759
dpy = XtDisplay(toplevel);
760
scr = XtScreen(toplevel);
761
XtAppAddActions(mainapp, acts, XtNumber(acts));
762
txt_trans = XtParseTranslationTable("#override \
763
<Key>Return: num-in()\n\
764
<Key>Linefeed: num-in()\n\
765
Ctrl<Key>M: num-in()\n\
766
Ctrl<Key>J: num-in()\n");
768
/* cmap = DefaultColormap(dpy, scr); */
770
XtVaSetValues(toplevel, XtNtitle, "ACfax display", NULL);
771
create_widgets(toplevel);
772
XtRealizeWidget(toplevel);
773
XtPopup(fax_shell, XtGrabNone);
774
create_pixmaps(fax_form);
776
fprintf(stderr,"allocing cmap\n"); fflush(stderr);
777
for (i=0; i<20; i++) respix[i] = 0;
778
respix[0] = BlackPixelOfScreen(scr);
779
respix[1] = WhitePixelOfScreen(scr);
780
XtVaGetValues(fax_form, XtNforeground, &respix[2],
781
XtNbackground, &respix[3],
783
XtNtopShadowPixel, &respix[4],
784
XtNbottomShadowPixel, &respix[5],
787
XtVaGetValues(mod_s.modemdesc, XtNbackground, &respix[6],
792
alloc_cmap(toplevel, respix, nrespix);
794
update_area = update_pxm;
795
mode_notify = op_changed;
796
/* that's a hard one, but should set up all things right.... */
797
XtVaGetValues(canvas, XtNwidth, &wid, XtNheight, &hei, NULL);
798
setup_fax(120, 288, (FAX_CNOR | FAX_CUNFL | FAX_CROT0 |
799
FAX_LEF2RIG | FAX_TOP2BOT | FAX_HOR | FAX_PBLK | FAX_GRAY),
800
toplevel, (unsigned)wid, (unsigned)hei, 500, (MOD_FM | FIL_MIDL));
807
printf("level = %d\n", signal_level());
811
fprintf(stderr,"filling cmap\n"); fflush(stderr);
812
/* make the colormap active for our shells */
813
XtVaSetValues(toplevel, XtNcolormap, icmap, NULL);
814
XtVaSetValues(fax_shell, XtNcolormap, icmap, NULL);
815
XtVaSetValues(info_s.shell, XtNcolormap, icmap, NULL);
816
/* get the pixmap where we have to draw in, and its GC */
817
cpxmap = canvasGetPixmap ((CanvasWidget)canvas, CanvasPicture);
818
cgc = canvasGetGC ((CanvasWidget)canvas, CanvasDrawGC);
820
fprintf(stderr,"initializing interface for FM reception...\n"); fflush(stderr);
823
comp_val = max_val >> 1;
824
aptncmax = smpl_sec / 100;
830
core_start = core_dta;
831
smpl_line = (2000 << 16) + 34800;
834
save_fsa.dir_io = malloc(256);
835
*save_fsa.dir_io = '\0';
836
save_fsa.title = "Save file";
837
save_fsa.file_act = savefile_act;
839
/* XtAddCallback(canvas, XtNcallback, show_coords, (XtPointer) NULL); */
840
XtAddCallback(dir_s.dirhv, XtNcallback, dirhv_cb, (XtPointer) NULL);
841
XtAddCallback(dir_s.dirlr, XtNcallback, dirlr_cb, (XtPointer) NULL);
842
XtAddCallback(dir_s.dirtb, XtNcallback, dirtb_cb, (XtPointer) NULL);
843
XtAddCallback(pol_s.norinv, XtNcallback, norinv_cb, (XtPointer) NULL);
844
XtAddCallback(pol_s.posneg, XtNcallback, posneg_cb, (XtPointer) NULL);
845
XtAddCallback(run_s.rmstop, XtNcallback, stastop_cb, (XtPointer) NULL);
846
XtAddCallback(run_s.rmsyn, XtNcallback, stastop_cb, (XtPointer) NULL);
847
XtAddCallback(run_s.rmrun, XtNcallback, stastop_cb, (XtPointer) NULL);
848
XtAddCallback(adj_s.lshift, XtNcallback, lshift_cb, (XtPointer) NULL);
849
XtAddCallback(adj_s.azimut, XtNcallback, azimut_cb, (XtPointer) NULL);
850
XtAddCallback(mod_s.mmode, XtNcallback, modmode_cb, (XtPointer) NULL);
851
XtAddCallback(file_m.autosave, XtNcallback, autosave_cb, (XtPointer) NULL);
852
XtAddCallback(file_m.saveas, XtNcallback, namesave_cb, (XtPointer) NULL);
853
XtAddCallback(file_m.close, XtNcallback, closesave_cb, (XtPointer) NULL);
854
XtAddCallback(file_m.quit, XtNcallback, quit_cb, (XtPointer) NULL);
855
XtAddCallback(mod_s.mflt1, XtNcallback, filtsel_cb, (XtPointer)FIL_NARR);
856
XtAddCallback(mod_s.mflt2, XtNcallback, filtsel_cb, (XtPointer)FIL_MIDL);
857
XtAddCallback(mod_s.mflt3, XtNcallback, filtsel_cb, (XtPointer)FIL_WIDE);
860
XtAddCallback(opt_start, XtNcallback, start_callback, (XtPointer) NULL);
861
XtAddCallback(opt_stop, XtNcallback, stop_callback, (XtPointer) NULL);
863
XtAppMainLoop(mainapp);