Lines Matching refs:ispell

30 /* $XdotOrg: xc/programs/xedit/ispell.c,v 1.6 2004/12/04 00:43:13 kuhn Exp $ */
31 /* $XFree86: xc/programs/xedit/ispell.c,v 1.19 2002/10/19 20:04:20 herrb Exp $ */
193 static struct _ispell ispell;
209 Offset(cmd), XtRString, "/usr/local/bin/ispell"},
315 WRITES("Warning: Timeout waiting ispell process to die.\n");
316 kill(ispell.pid, SIGTERM);
324 XawTextSetInsertionPoint(ispell.ascii, right);
325 XawTextSetInsertionPoint(ispell.ascii, left);
326 XawTextSetSelection(ispell.ascii, left, right);
335 XtSetValues(ispell.status, args, 1);
346 XtGetValues(ispell.mispelled, args, 1);
351 XtGetValues(ispell.repeated, args, 1);
354 XtSetSensitive(ispell.replaceAll, !state);
355 XtSetSensitive(ispell.ignoreAll, !state);
356 XtSetSensitive(ispell.add, !state);
357 XtSetSensitive(ispell.addUncap, !state);
360 XtSetValues(ispell.mispelled, args, 1);
364 XtSetValues(ispell.mispelled, args, 1);
371 XtSetSensitive(ispell.replace, state);
372 XtSetSensitive(ispell.replaceAll, state);
373 XtSetSensitive(ispell.ignore, state);
374 XtSetSensitive(ispell.ignoreAll, state);
375 XtSetSensitive(ispell.add, state);
376 XtSetSensitive(ispell.addUncap, state);
384 XtSetArg(args[0], XtNstate, ispell.terse_mode = mode);
385 XtSetValues(ispell.terse, args, 1);
386 write(ispell.ofd[1], mode ? "!\n" : "%\n", 2);
394 if (ispell.undo_for && strcmp(ispell.undo_for, ispell.dictionary)) {
402 undo->terse = ispell.undo_terse_mode;
403 undo->format = ispell.format_mode;
404 if ((undo->prev = ispell.undo_head) != NULL)
408 ++ispell.undo_depth;
409 if (!ispell.undo_base) {
410 ispell.undo_base = undo;
411 XtSetSensitive(ispell.undo, True);
413 else if (ispell.undo_depth > UNDO_DEPTH) {
416 if (ispell.undo_base->undo_str)
417 XtFree(ispell.undo_base->undo_str);
418 tmp = ispell.undo_base->next;
419 XtFree((char*)ispell.undo_base);
421 ispell.undo_base = tmp;
422 ispell.undo_depth = UNDO_DEPTH;
424 ispell.undo_head = undo;
533 if (ispell.lock || ispell.stat != RECEIVE)
537 if (ispell.buflen >= ispell.bufsiz - 1)
538 ispell.buf = XtRealloc(ispell.buf, ispell.bufsiz += BUFSIZ);
539 if ((len = read(ispell.ifd[0], &ispell.buf[ispell.buflen],
540 ispell.bufsiz - ispell.buflen - 1)) <= 0)
542 ispell.buflen += len;
544 if (ispell.buflen <= 0)
547 i = ispell.buflen - 1;
548 while (i >= 0 && ispell.buf[i] == '\n') {
552 if (len < 2 - ((ispell.terse_mode && i == -1) || ispell.buf[0] == '@'))
554 ispell.buf[ispell.buflen - len] = '\0';
555 ispell.buflen = 0;
557 if ((tmp = strchr(ispell.sendbuf, '\n')) != NULL)
560 switch (ispell.buf[0]) {
563 str = strchr(&ispell.buf[2], ' ');
564 if (!ispell.checkit) {
566 XtSetArg(args[0], XtNlabel, &ispell.buf[2]);
567 XtSetValues(ispell.word, args, 1);
619 XtGetValues(ispell.list, args, 2);
621 ispell.item = NULL;
622 if ((str = IspellReplacedWord(&ispell.buf[2], NULL)) != NULL)
625 ispell.item = list[i];
630 ispell.item = list[i = 0];
631 if (!ispell.item) {
633 ispell.item = list[i] = XtNewString(str);
639 XtSetValues(ispell.list, args, 2);
641 XtSetSensitive(ispell.list, True);
642 if (!ispell.checkit)
643 XawListHighlight(ispell.list, i);
645 if (old_len > 1 || (XtName(ispell.list) != old_list[0])) {
651 if (!ispell.checkit) {
652 XtSetArg(args[0], XtNstring, ispell.item);
653 XtSetValues(ispell.text, args, 1);
654 IspellSetSelection(ispell.left, ispell.right);
655 if (ispell.repeat)
656 IspellSetRepeated(ispell.repeat = False);
659 IspellSetStatus(ispell.buf[0] == '?' ?
660 ispell.guess_label : ispell.miss_label);
661 ispell.undo_terse_mode = ispell.terse_mode;
662 ispell.format_mode = ispell.format_info->value;
663 ispell.lock = True;
669 str = &ispell.sendbuf[1];
670 if (!ispell.checkit) {
672 XtSetValues(ispell.word, args, 1);
677 XtGetValues(ispell.list, args, 2);
678 ispell.item = NULL;
683 if (tmp == NULL && ispell.buf[0] == '#')
690 XtSetValues(ispell.list, args, 2);
692 if (tmp == NULL && ispell.buf[0] == '#') {
693 XawListUnhighlight(ispell.list);
694 XtSetSensitive(ispell.list, False);
697 XtSetSensitive(ispell.list, True);
698 if (!ispell.checkit)
699 XawListHighlight(ispell.list, 0);
701 if (old_len > 1 || (XtName(ispell.list) != old_list[0])) {
707 if (!ispell.checkit) {
709 XtSetValues(ispell.text, args, 1);
710 IspellSetSelection(ispell.left, ispell.right);
711 if (ispell.repeat)
712 IspellSetRepeated(ispell.repeat = False);
715 ispell.undo_terse_mode = ispell.terse_mode;
716 ispell.format_mode = ispell.format_info->value;
717 ispell.lock = True;
718 if (ispell.buf[0] == '+') {
719 if ((tmp = strchr(&ispell.buf[2], '\n')) != NULL)
722 ispell.root_label, &ispell.buf[2]);
726 IspellSetStatus(ispell.buf[0] == '#' ? ispell.none_label :
727 ispell.buf[0] == '-' ? ispell.compound_label :
728 ispell.ok_label);
732 if (!ispell.checkit)
733 (void)IspellIgnoredWord(&ispell.sendbuf[1], ADD, 0);
736 ispell.lock = False;
740 if (!ispell.repeat) {
743 ispell.stat = SEND;
747 XawTextGetSelectionPos(ispell.ascii, &left, &right);
748 if (left != ispell.left || right != ispell.right) {
749 XtSetArg(args[0], XtNstring, &ispell.sendbuf[1]);
750 XtSetValues(ispell.text, args, 1);
751 IspellSetSelection(ispell.left, ispell.right);
753 ispell.checkit = True;
756 IspellSetStatus(ispell.repeat_label);
757 ispell.undo_terse_mode = ispell.terse_mode;
758 ispell.format_mode = ispell.format_info->value;
759 ispell.lock = True;
764 fprintf(stderr, "Unknown ispell command '%c'\n", ispell.buf[0]);
768 if (!ispell.lock && !ispell.checkit) {
769 ispell.stat = SEND;
883 if (ispell.lock || ispell.stat != SEND)
887 ispell.sendbuf[0] = '^'; /* don't evaluate following characters as commands */
891 html = ispell.format_info->value == HTML;
896 pos = position = ispell.right;
903 position = XawTextSourceRead(ispell.source, position,
906 ispell.stat = 0;
907 ispell.lock = True;
908 XawTextSetInsertionPoint(ispell.ascii, ispell.right);
909 XawTextUnsetSelection(ispell.ascii);
911 IspellSetStatus(ispell.eof_label);
921 if (!ispell.terse_mode)
934 (ch && strchr(ispell.wchars, ch))) {
936 ispell.right = pos;
953 (*mb && strchr(ispell.wchars, *mb)))) {
966 if (*mb && strchr(ispell.skip, *mb)) {
967 position = ispell.right =
968 XawTextSourceScan(ispell.source, ispell.right + i,
990 ispell.right += i;
995 old_left = ispell.left;
998 position = ispell.left = ispell.right;
1004 position = XawTextSourceRead(ispell.source, position,
1007 ispell.stat = 0;
1008 ispell.lock = True;
1009 XawTextSetInsertionPoint(ispell.ascii, ispell.right);
1010 XawTextUnsetSelection(ispell.ascii);
1012 IspellSetStatus(ispell.eof_label);
1022 if (!ispell.terse_mode)
1026 if (strchr(ispell.wchars, '&')) {
1027 if (len + 1 >= sizeof(ispell.sendbuf) - 1) {
1032 ispell.sendbuf[len++] = '&';
1036 ispell.right = position;
1049 (!ch || !strchr(ispell.wchars, ch))) {
1050 ispell.right = pos;
1065 else if (!isalpha(*mb) && (!*mb || !strchr(ispell.wchars, *mb))) {
1069 ispell.sendbuf[len] = *mb;
1070 if (++len >= sizeof(ispell.sendbuf) - 1) {
1076 ispell.right += i;
1081 ispell.sendbuf[len] = '\0';
1083 if (spaces > 0 && spaces <= 32 && strcmp(ispell.sendbuf, ispell.sentbuf) == 0) {
1087 char label[sizeof(ispell.sendbuf) + sizeof(ispell.sentbuf) + 32];
1089 strcpy(label, &ispell.sendbuf[1]);
1092 strcpy(&label[len + i - 1], &ispell.sendbuf[1]);
1094 XtSetValues(ispell.word, args, 1);
1096 XtSetArg(args[0], XtNstring, &ispell.sendbuf[1]);
1097 XtSetValues(ispell.text, args, 1);
1101 XtGetValues(ispell.list, args, 2);
1103 list[0] = XtNewString(&ispell.sendbuf[1]);
1106 XtSetValues(ispell.list, args, 2);
1107 XtSetSensitive(ispell.list, True);
1108 XawListHighlight(ispell.list, 0);
1109 if (old_len > 1 || (XtName(ispell.list) != old_list[0])) {
1116 IspellSetSelection(old_left, ispell.right);
1117 IspellSetStatus(ispell.repeat_label);
1118 ispell.repeat = ispell.lock = True;
1122 strcpy(ispell.sentbuf, ispell.sendbuf);
1124 if (len <= 2 || IspellIgnoredWord(&ispell.sendbuf[1], CHECK, 0))
1127 ispell.sendbuf[len++] = '\n';
1129 write(ispell.ofd[1], ispell.sendbuf, len);
1131 ispell.stat = RECEIVE;
1140 if (ispell.right < 0) {
1144 ispell.right = XawTextGetInsertionPoint(ispell.ascii);
1145 ispell.right = XawTextSourceScan(ispell.source, ispell.right,
1147 len = read(ispell.ifd[0], buf, sizeof(buf));
1153 XtSetValues(ispell.shell, args, 1);
1156 fprintf(stderr, "Error: is ispell talking with me?\n");
1157 IspellSetTerseMode(ispell.terse_mode);
1161 else if (ispell.source)
1189 if (!XtIsSubclass(w, textWidgetClass) || ispell.source) {
1194 ispell.source = XawTextGetSource(ispell.ascii = w);
1197 /* let the user choose the better position for the ispell window */
1221 XQueryPointer(XtDisplay(ispell.shell), XtWindow(ispell.shell),
1231 XtGetValues(ispell.shell, args, num_args);
1251 XtSetValues(ispell.shell, args, num_args);
1254 if (ispell.repeat)
1256 ispell.lock = ispell.repeat = ispell.checkit = False;
1257 ispell.stat = SEND;
1260 XtSetSensitive(ispell.undo, False);
1263 XtSetValues(ispell.word, args, 1);
1266 XtSetValues(ispell.text, args, 1);
1270 XtGetValues(ispell.list, args, 2);
1276 XtSetValues(ispell.list, args, 2);
1278 if (n_strs > 1 || (XtName(ispell.list) != strs[0])) {
1284 IspellSetStatus(ispell.working_label);
1286 if (!ispell.pid)
1289 ispell.right = XawTextGetInsertionPoint(ispell.ascii);
1290 ispell.right = XawTextSourceScan(ispell.source, ispell.right,
1296 XtPopup(ispell.shell, XtGrabExclusive);
1297 XtSetKeyboardFocus(ispell.shell, ispell.text);
1303 if (!ispell.pid) {
1308 ispell.source = XawTextGetSource(ispell.ascii);
1314 len = strlen(ispell.cmd) + 4;
1315 if (ispell.dictionary && *ispell.dictionary) {
1316 len += strlen(ispell.dictionary) + 6;
1318 if (ispell.wchars && *ispell.wchars) {
1319 len += strlen(ispell.wchars + 6);
1325 ispell.cmd, ispell.dictionary, ispell.wchars);
1327 pipe(ispell.ifd);
1328 pipe(ispell.ofd);
1329 if ((ispell.pid = fork()) == 0) {
1332 dup2(ispell.ofd[0], 0);
1333 dup2(ispell.ifd[1], 1);
1334 close(ispell.ofd[0]);
1335 close(ispell.ofd[1]);
1336 close(ispell.ifd[0]);
1337 close(ispell.ifd[1]);
1343 else if (ispell.pid < 0) {
1347 ispell.buf = XtMalloc(ispell.bufsiz = BUFSIZ);
1348 ispell.right = -1;
1349 ispell.id = XtAppAddInput(XtWidgetToApplicationContext(ispell.shell),
1350 ispell.ifd[0], (XtPointer)XtInputReadMask,
1352 fcntl(ispell.ifd[0], F_SETFL, O_NONBLOCK);
1365 XtPopdown(ispell.shell);
1366 *ispell.sentbuf = '\0';
1374 if (ispell.pid) {
1375 waitpid(ispell.pid, &status, WNOHANG);
1377 ispell.pid = 0;
1389 ispell.source = NULL;
1391 if (ispell.pid) {
1401 write(ispell.ofd[1], "&", 1);
1403 write(ispell.ofd[1], "*", 1);
1404 write(ispell.ofd[1], ientry->word->value, ientry->word->length);
1405 write(ispell.ofd[1], "\n", 1);
1408 write(ispell.ofd[1], "#\n", 2); /* save dictionary */
1412 XtRemoveInput(ispell.id);
1414 close(ispell.ofd[0]);
1415 close(ispell.ofd[1]);
1416 close(ispell.ifd[0]);
1417 close(ispell.ifd[1]);
1422 waitpid(ispell.pid, NULL, 0);
1426 ispell.pid = 0;
1427 if (ispell.buf)
1428 XtFree(ispell.buf);
1429 ispell.buf = NULL;
1454 undo = pundo = ispell.undo_base;
1462 ispell.undo_base = ispell.undo_head = NULL;
1463 ispell.undo_for = NULL;
1464 ispell.undo_depth = 0;
1465 XtSetSensitive(ispell.undo, False);
1476 XtGetValues(ispell.word, args, 1);
1482 XtSetValues(ispell.text, args, 1);
1494 XtSetArg(args[0], XtNstring, ispell.item = info->string);
1495 XtSetValues(ispell.text, args, 1);
1502 XawTextPosition pos = XawTextGetInsertionPoint(ispell.ascii);
1507 if (!ispell.lock)
1511 XtGetValues(ispell.word, args, 1);
1515 search.length = ispell.right - pos;
1518 XtGetValues(ispell.text, args, 1);
1525 XawTextReplace(ispell.ascii, pos, pos + search.length,
1527 ispell.right += replace.length - search.length;
1529 ispell.undo_head->undo_str = NULL;
1530 ispell.undo_head->undo_pos = pos;
1531 ispell.undo_head->undo_count = 1;
1533 if (ispell.repeat) {
1534 ispell.undo_head->repeat = 2; /* To recognize later it was replaced */
1535 ispell.undo_head->undo_count = ispell.right;
1536 ispell.undo_head->undo_str = XtNewString(search.ptr);
1538 if (client_data && !ispell.repeat) {
1539 XawTextDisableRedisplay(ispell.ascii);
1540 pos = ispell.right;
1541 while ((pos = XawTextSourceSearch(ispell.source, pos, XawsdRight, &search))
1546 if (XawTextSourceRead(ispell.source, pos - 1, &check, 1) > 0) {
1551 do_replace = !isalpha(*mb) && *mb && !strchr(ispell.wchars, *mb);
1554 XawTextSourceRead(ispell.source, pos + search.length, &check, 1) > 0) {
1559 do_replace = !isalpha(*mb) && *mb && !strchr(ispell.wchars, *mb);
1562 XawTextReplace(ispell.ascii, pos, pos + search.length, &replace);
1563 ++ispell.undo_head->undo_count;
1567 XawTextEnableRedisplay(ispell.ascii);
1571 strncpy(&ispell.sentbuf[1], replace.ptr, sizeof(ispell.sentbuf) - 2);
1572 ispell.sentbuf[sizeof(ispell.sentbuf) - 1] = '\0';
1577 if (ispell.repeat)
1578 ispell.right = ispell.left = XawTextGetInsertionPoint(ispell.ascii);
1579 else if (!ispell.terse_mode || !ispell.item ||
1580 strcmp(ispell.item, replace.ptr))
1581 ispell.right = ispell.left; /* check it again! */
1583 ispell.lock = ispell.checkit = False;
1585 ispell.stat = SEND;
1586 IspellSetStatus(ispell.working_label);
1598 if (!ispell.lock)
1602 XtGetValues(ispell.word, args, 1);
1606 if ((ispell.undo_head->repeat = ispell.repeat) != False) {
1607 ispell.undo_head->undo_count = ispell.right;
1608 ispell.undo_head->undo_str = XtNewString(text);
1611 ispell.undo_head->undo_count = 0;
1613 ispell.undo_head->undo_pos = XawTextGetInsertionPoint(ispell.ascii);
1615 if (!ispell.repeat) {
1618 ispell.undo_head->undo_str = XtNewString(text);
1621 ispell.undo_head->undo_str = NULL;
1624 ispell.lock = ispell.checkit = False;
1626 ispell.stat = SEND;
1627 IspellSetStatus(ispell.working_label);
1640 if (!ispell.lock || ispell.repeat)
1644 XtGetValues(ispell.word, args, 1);
1647 ispell.undo_head->undo_str = XtNewString(text);
1648 ispell.undo_head->undo_pos = XawTextGetInsertionPoint(ispell.ascii);
1649 ispell.undo_head->undo_count = -cmd;
1653 ispell.lock = ispell.checkit = False;
1654 ispell.stat = SEND;
1655 IspellSetStatus(ispell.working_label);
1665 ispell_undo *undo = ispell.undo_head;
1667 if ((!ispell.lock && ispell.stat) || !undo)
1670 if (ispell.undo_for && strcmp(ispell.undo_for, ispell.dictionary)) {
1677 if (undo->terse != ispell.terse_mode)
1680 if (undo->format != ispell.format_info->value) {
1690 XawTextDisableRedisplay(ispell.ascii);
1692 if (!_XawTextSrcUndo((TextSrcObject)ispell.source, &tmp)) {
1706 XawTextSetInsertionPoint(ispell.ascii,
1707 ispell.right = ispell.left = undo->undo_pos);
1709 XawTextEnableRedisplay(ispell.ascii);
1718 XawTextDisableRedisplay(ispell.ascii);
1719 if (!_XawTextSrcUndo((TextSrcObject)ispell.source, &ispell.right))
1721 XawTextEnableRedisplay(ispell.ascii);
1724 ispell.right = (XawTextPosition)undo->undo_count;
1725 IspellSetRepeated(ispell.repeat = True);
1727 XtSetValues(ispell.word, args, 1);
1728 XmuSnprintf(ispell.sentbuf, sizeof(ispell.sentbuf), "^%s",
1730 strcpy(ispell.sendbuf, ispell.sentbuf);
1731 XtSetArg(args[0], XtNstring, &ispell.sentbuf[1]);
1732 XtSetValues(ispell.text, args, 1);
1736 XtGetValues(ispell.list, args, 2);
1739 list[0] = XtNewString(&ispell.sentbuf[1]);
1742 XtSetValues(ispell.list, args, 2);
1743 XtSetSensitive(ispell.list, True);
1744 XawListHighlight(ispell.list, 0);
1746 if (old_len > 1 || (XtName(ispell.list) != old_list[0])) {
1752 IspellSetSelection(ispell.left, ispell.right);
1753 IspellSetStatus(ispell.repeat_label);
1754 ispell.lock = True;
1755 ispell.checkit = False;
1757 else if (ispell.repeat) {
1758 *ispell.sentbuf = '\0';
1759 IspellSetRepeated(ispell.repeat = False);
1764 ispell.undo_head = undo->prev;
1765 if (undo == ispell.undo_base) {
1766 ispell.undo_base = NULL;
1767 ispell.undo_for = NULL;
1768 XtSetSensitive(ispell.undo, False);
1773 --ispell.undo_depth;
1775 if (!ispell.stat || ispell.checkit)
1778 if (!ispell.repeat) {
1779 ispell.lock = ispell.checkit = False;
1780 ispell.stat = SEND;
1781 IspellSetStatus(ispell.working_label);
1795 if (!ispell.lock)
1799 XtGetValues(ispell.text, args, 1);
1805 if (isalpha(*str) || strchr(ispell.wchars, *str))
1812 if (isalpha(*str) || strchr(ispell.wchars, *str))
1820 XawTextPosition pos = XawTextGetInsertionPoint(ispell.text) - len;
1823 XtSetValues(ispell.text, args, 1);
1824 XawTextSetInsertionPoint(ispell.text, pos);
1833 len = XmuSnprintf(ispell.sendbuf, sizeof(ispell.sendbuf), "^%s\n", string);
1835 ispell.sendbuf[sizeof(ispell.sendbuf) - 1] = '\n';
1837 write(ispell.ofd[1], ispell.sendbuf, len);
1839 ispell.lock = False;
1840 ispell.checkit = True;
1841 ispell.stat = RECEIVE;
1854 if (!ispell.lock)
1858 XtGetValues(ispell.text, args, 1);
1865 if (strlen(ispell.look_cmd) + strlen(text) + strlen(ispell.words_file) + 8
1872 ispell.look_cmd, text, ispell.words_file);
1875 fprintf(stderr, "Cannot popen '%s'\n", ispell.look_cmd);
1901 XtGetValues(ispell.list, args, 2);
1912 XtSetValues(ispell.list, args, 2);
1914 XtSetSensitive(ispell.list, sensitive);
1915 IspellSetStatus(sensitive ? ispell.look_label : ispell.none_label);
1917 if (old_len > 1 || (XtName(ispell.list) != old_list[0])) {
1930 if (!ispell.lock)
1933 ispell.terse_mode = !ispell.terse_mode;
1934 write(ispell.ofd[1], ispell.terse_mode ? "!\n" : "%\n", 2);
1942 XawTextPosition pos = XawTextGetInsertionPoint(ispell.ascii);
1943 XawTextPosition right = ispell.right;
1946 if (strcmp(XtName(dic->sme), ispell.dictionary) == 0)
1949 if (!ispell.lock) {
1956 for (tmp = ispell.dict_info; tmp; tmp = tmp->next)
1957 if (strcmp(XtName(tmp->sme), ispell.dictionary) == 0) {
1962 if (ispell.undo_base && !ispell.undo_for)
1963 ispell.undo_for = ispell.dictionary;
1967 ispell.dictionary = XtName(dic->sme);
1968 ispell.wchars = dic->wchars;
1970 XtSetValues(ispell.dict, args, 1);
1972 IspellSetStatus(ispell.working_label);
1975 ispell.lock = ispell.checkit = False;
1978 ispell.stat = RECEIVE;
1981 if (ispell.repeat == False)
1982 ispell.left = ispell.right = pos;
1984 ispell.right = right;
1994 if (strcmp(fmt->name, ispell.formatting) == 0)
1997 if (!ispell.lock) {
2003 XtSetValues(ispell.format_info->sme, args, 1);
2007 ispell.formatting = fmt->name;
2008 ispell.format_info = fmt;
2010 XtSetValues(ispell.format, args, 1);
2026 if (ispell.shell)
2032 ispell.shell = XtCreatePopupShell("ispell", transientShellWidgetClass,
2035 XtGetApplicationResources(ispell.shell, (XtPointer)&ispell, resources,
2038 ispell.form = XtCreateManagedWidget("form", formWidgetClass,
2039 ispell.shell, NULL, 0);
2040 ispell.mispelled = XtCreateManagedWidget("mispelled", labelWidgetClass,
2041 ispell.form, NULL, 0);
2042 ispell.repeated = XtCreateWidget("repeated", labelWidgetClass,
2043 ispell.form, NULL, 0);
2044 ispell.word = XtCreateManagedWidget("word", commandWidgetClass,
2045 ispell.form, NULL, 0);
2046 XtAddCallback(ispell.word, XtNcallback, RevertIspell, NULL);
2047 ispell.replacement = XtCreateManagedWidget("replacement", labelWidgetClass,
2048 ispell.form, NULL, 0);
2049 ispell.text = XtVaCreateManagedWidget("text", asciiTextWidgetClass,
2050 ispell.form,
2053 ispell.suggestions = XtCreateManagedWidget("suggestions", labelWidgetClass,
2054 ispell.form, NULL, 0);
2055 ispell.viewport = XtCreateManagedWidget("viewport", viewportWidgetClass,
2056 ispell.form, NULL, 0);
2057 ispell.list = XtCreateManagedWidget("list", listWidgetClass,
2058 ispell.viewport, NULL, 0);
2059 XtAddCallback(ispell.list, XtNcallback, SelectIspell, NULL);
2060 ispell.commands = XtCreateManagedWidget("commands", formWidgetClass,
2061 ispell.form, NULL, 0);
2062 ispell.check = XtCreateManagedWidget("check", commandWidgetClass,
2063 ispell.commands, NULL, 0);
2064 XtAddCallback(ispell.check, XtNcallback, CheckIspell, NULL);
2065 ispell.look = XtCreateManagedWidget("look", commandWidgetClass,
2066 ispell.commands, NULL, 0);
2067 XtAddCallback(ispell.look, XtNcallback, LookIspell, NULL);
2068 ispell.undo = XtCreateManagedWidget("undo", commandWidgetClass,
2069 ispell.commands, NULL, 0);
2070 XtAddCallback(ispell.undo, XtNcallback, UndoIspell, NULL);
2071 ispell.replace = XtCreateManagedWidget("replace", commandWidgetClass,
2072 ispell.commands, NULL, 0);
2073 XtAddCallback(ispell.replace, XtNcallback, ReplaceIspell, (XtPointer)False);
2074 ispell.replaceAll = XtCreateManagedWidget("replaceAll", commandWidgetClass,
2075 ispell.commands, NULL, 0);
2076 XtAddCallback(ispell.replaceAll, XtNcallback, ReplaceIspell, (XtPointer)True);
2077 ispell.ignore = XtCreateManagedWidget("ignore", commandWidgetClass,
2078 ispell.commands, NULL, 0);
2079 XtAddCallback(ispell.ignore, XtNcallback, IgnoreIspell, (XtPointer)False);
2080 ispell.ignoreAll = XtCreateManagedWidget("ignoreAll", commandWidgetClass,
2081 ispell.commands, NULL, 0);
2082 XtAddCallback(ispell.ignoreAll, XtNcallback, IgnoreIspell, (XtPointer)True);
2083 ispell.add = XtCreateManagedWidget("add", commandWidgetClass,
2084 ispell.commands, NULL, 0);
2085 XtAddCallback(ispell.add, XtNcallback, AddIspell, (XtPointer)ASIS);
2086 ispell.addUncap = XtCreateManagedWidget("addUncap", commandWidgetClass,
2087 ispell.commands, NULL, 0);
2088 XtAddCallback(ispell.addUncap, XtNcallback, AddIspell, (XtPointer)UNCAP);
2089 ispell.suspend = XtCreateManagedWidget("suspend", commandWidgetClass,
2090 ispell.commands, NULL, 0);
2091 XtAddCallback(ispell.suspend, XtNcallback, PopdownIspell, (XtPointer)False);
2092 ispell.cancel = XtCreateManagedWidget("cancel", commandWidgetClass,
2093 ispell.commands, NULL, 0);
2094 XtAddCallback(ispell.cancel, XtNcallback, PopdownIspell, (XtPointer)True);
2095 ispell.terse = XtVaCreateManagedWidget("terse", toggleWidgetClass,
2096 ispell.commands,
2097 XtNstate, ispell.terse_mode,
2099 XtAddCallback(ispell.terse, XtNcallback, ToggleTerseIspell, NULL);
2100 ispell.status = XtCreateManagedWidget("status", labelWidgetClass,
2101 ispell.form, NULL, 0);
2102 ispell.options = XtCreateManagedWidget("options", formWidgetClass,
2103 ispell.form, NULL, 0);
2104 ispell.dict = XtVaCreateManagedWidget("dict", menuButtonWidgetClass,
2105 ispell.options,
2108 ispell.dictMenu = XtCreatePopupShell("dictionaries", simpleMenuWidgetClass,
2109 ispell.options, NULL, 0);
2110 XtRealizeWidget(ispell.dictMenu);
2112 ispell.format = XtVaCreateManagedWidget("format", menuButtonWidgetClass,
2113 ispell.options,
2116 ispell.formatMenu = XtCreatePopupShell("formats", simpleMenuWidgetClass,
2117 ispell.options, NULL, 0);
2118 XtRealizeWidget(ispell.formatMenu);
2120 XtRealizeWidget(ispell.shell);
2126 ispell.formatMenu, NULL, 0);
2129 if (strcmp(fmt->name, ispell.formatting) == 0) {
2132 XtSetArg(args[0], XtNlabel, ispell.formatting);
2133 XtSetValues(ispell.format, args, 1);
2136 ispell.format_info = fmt;
2139 if (ispell.format_info == NULL) {
2143 ispell.format_info = &ispell_format[TEXT];
2147 ispell.formatting, ispell.format_info->name);
2148 XtAppWarning(XtWidgetToApplicationContext(ispell.shell), msg);
2149 ispell.formatting = ispell.format_info->name;
2151 XtSetArg(args[0], XtNlabel, ispell.format_info->name);
2152 XtSetValues(ispell.format, args, 1);
2154 XtSetValues(ispell.format_info->sme, args, 1);
2156 XtGetApplicationResources(ispell_format[TEXT].sme, (XtPointer)&ispell,
2167 list = XtNewString(ispell.dict_list);
2172 ispell.dictMenu, NULL, 0);
2176 ispell.dict_info = prev_dict = dict;
2181 ispell.dictMenu, NULL, 0);
2192 for (dict = ispell.dict_info; dict; dict = dict->next) {
2193 if (strcmp(XtName(dict->sme), ispell.dictionary) == 0) {
2199 XtSetValues(ispell.dict, args, 1);
2200 ispell.wchars = dict->wchars;
2206 delete_window = XInternAtom(XtDisplay(ispell.shell), "WM_DELETE_WINDOW", False);
2207 XSetWMProtocols(XtDisplay(ispell.shell), XtWindow(ispell.shell), &delete_window, 1);