File: allMode.c

package info (click to toggle)
xrn 9.02-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,820 kB
  • ctags: 3,233
  • sloc: ansic: 24,690; makefile: 2,685; yacc: 888; sh: 252; lex: 92; perl: 35; awk: 31; csh: 13
file content (907 lines) | stat: -rw-r--r-- 21,414 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
#include <X11/Intrinsic.h>
#include <X11/Xaw3d/Box.h>
#include <X11/Xaw3d/Paned.h>

#include "config.h"
#include "buttons.h"
#include "butdefs.h"
#include "butexpl.h"
#include "allMode.h"
#include "ngMode.h"
#include "modes.h"
#include "Text.h"
#include "InfoLine.h"
#include "ButtonBox.h"
#include "news.h"
#include "internals.h"
#include "cursor.h"
#include "mesg_strings.h"
#include "dialogs.h"
#include "mesg.h"
#include "artMode.h"
#include "compose.h"
#include "resources.h"

static char *AllGroupsString = 0;
static int AllStatus = 1;	/* keeps track of which order to put the */
				/* groups in in all groups mode */
static Widget AllFrame, AllText, AllInfoLine, AllButtonBox;
static long First, Last;

static char *LimitString = NULL;

BUTTON(allQuit,quit);
BUTTON(allNext,next);
BUTTON(allPrev,prev);
BUTTON(allScroll,scroll forward);
BUTTON(allScrollBack,scroll backward);
BUTTON(allSearch,search);
BUTTON(allLimit,limit);
BUTTON(allSub,subscribe);
BUTTON(allFirst,subscribe first);
BUTTON(allLast,subscribe last);
BUTTON(allAfter,subscribe after group);
BUTTON(allUnsub,unsubscribe);
BUTTON(allIgnore,ignore);
BUTTON(allGoto,goto group);
BUTTON(allSelect,select groups);
BUTTON(allMove,move);
BUTTON(allToggle,toggle order);
BUTTON(allPost,post to group);
BUTTON(allPostAndMail,post to group and mail);
BUTTON(allMail,mail);

XtActionsRec AllActions[] = {
    {"allQuit",		allQuitAction},
    {"allNext",		allNextAction},
    {"allPrev",		allPrevAction},
    {"allScroll",	allScrollAction},
    {"allScrollBack",	allScrollBackAction},
    {"allSearch",	allSearchAction},
    {"allLimit",	allLimitAction},
    {"allSub",		allSubAction},
    {"allFirst",	allFirstAction},
    {"allLast",		allLastAction},
    {"allAfter",	allAfterAction},
    {"allUnsub",	allUnsubAction},
    {"allIgnore",	allIgnoreAction},
    {"allGoto",		allGotoAction},
    {"allSelect",	allSelectAction},
    {"allMove",		allMoveAction},
    {"allToggle",	allToggleAction},
    {"allPost",		allPostAction},
    {"allPostAndMail",	allPostAndMailAction},
    {"allMail",		allMailAction},
};

int AllActionsCount = XtNumber(AllActions);

static ButtonList AllButtonList[] = {
  {"allQuit",	     allQuitCallbacks,	      ALLQUIT_EXSTR,	      True},
  {"allNext",	     allNextCallbacks,	      NGNEXT_EXSTR,	      True},
  {"allPrev",	     allPrevCallbacks,	      NGPREV_EXSTR,	      True},
  {"allScroll",	     allScrollCallbacks,      ALLSCROLL_EXSTR,	      True},
  {"allScrollBack",  allScrollBackCallbacks,  ALLSCROLLBACK_EXSTR,    True},
  {"allSearch",      allSearchCallbacks,      ALLSEARCH_EXSTR,        True},
  {"allLimit",       allLimitCallbacks,       ALLLIMIT_EXSTR,         True},
  {"allSub",	     allSubCallbacks,	      ALLSUB_EXSTR,	      True},
  {"allFirst",	     allFirstCallbacks,	      ALLFIRST_EXSTR,	      True},
  {"allLast",	     allLastCallbacks,	      ALLLAST_EXSTR,	      True},
  {"allAfter",	     allAfterCallbacks,	      ALLAFTER_EXSTR,	      True},
  {"allUnsub",	     allUnsubCallbacks,	      ALLUNSUB_EXSTR,	      True},
  {"allIgnore",	     allIgnoreCallbacks,      ALLIGNORE_EXSTR,	      True},
  {"allGoto",	     allGotoCallbacks,	      ALLGOTO_EXSTR,	      True},
  {"allSelect",	     allSelectCallbacks,      ALLSELECT_EXSTR,	      True},
  {"allMove",	     allMoveCallbacks,	      ALLMOVE_EXSTR,	      True},
  {"allToggle",	     allToggleCallbacks,      ALLTOGGLE_EXSTR,	      True},
  {"allPost",	     allPostCallbacks,	      ALLPOST_EXSTR,	      True},
  {"allPostAndMail", allPostAndMailCallbacks, ALLPOST_AND_MAIL_EXSTR, True},
  {"allMail",	     allMailCallbacks,	      MAIL_EXSTR,	      True},
};

static int AllButtonListCount = XtNumber(AllButtonList);

static void allResetSelection()
{
    setButtonSensitive(AllButtonBox, "allMove", False);
    First = Last = 0;
}

/*
 * Redraw the all groups window, assuming it has changed
 */
void redrawAllWidget()
{
    String new;

    if (CurrentMode != ALL_MODE) {
	return;
    }

    while (! (new = getStatusString(TextGetColumns(AllText),
				    AllStatus, LimitString))) {
      FREE(LimitString);
    }

    if (!AllGroupsString || strcmp(AllGroupsString, new)) {
	allResetSelection();
	TextSetString(AllText, new);
	FREE(AllGroupsString);
	AllGroupsString = new;
    }
    else {
	FREE(new);
    }
}


void updateAllWidget(string, left, right)
    String string;
    long left, right;
{
    long current, top = TextGetTopPosition(AllText);

    TextDisableRedisplay(AllText);

    TextInvalidate(AllText, string, left, right);
    current = right;
    (void) setCursorCurrent(string, &current);
    TextSetInsertionPoint(AllText, current);
    TextSetTopPosition(AllText, top);

    TextEnableRedisplay(AllText);

    return;
}

void switchToAllMode()
{
    FREE(AllGroupsString);
    FREE(LimitString); /* also done in allQuitFunction, but it
			  doesn't hurt to be cautious */
    PreviousMode = CurrentMode;
    CurrentMode = ALL_MODE;
    /* switch buttons */
    swapMode();

    setBottomInfoLine(VIEW_ALLNG_SUB_MSG);
    /* create the screen */
    AllGroupsString = getStatusString(TextGetColumns(AllText), AllStatus,
				      LimitString);

    TextSetString(AllText, AllGroupsString);

    return;
}

/*
 * Quit all groups mode.
 */
/*ARGSUSED*/
void allQuitFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    if (CurrentMode != ALL_MODE) {
	return;
    }

    FREE(AllGroupsString);
    FREE(LimitString); /* also done in switchToAllMode, but it doesn't
			  hurt to be cautious */

    switchToNewsgroupMode(False);
}

static String allNewsgroupIterator(start, out_left)
    Boolean start;
    long *out_left;
{
    return anyIterator(AllText, AllGroupsString, True, start, False,
		       out_left);
}

static void doAll(status, first, last, group)
    int status;
    Boolean first, last;
    String group;
{
    String newGroup;
    char *oldGroup = 0;
    int oldGroupSize = 0;
    long first_left, left;
    Boolean in_place = (AllStatus || (! (first || last || group)));
    int ret;
    int len;
    /* Args for the call to currentMode */
    int old_status;
    char *current_group = 0;

    if (CurrentMode != ALL_MODE) {
	return;
    }

    if (allNewsgroupIterator(True, &first_left)) {
	while ((newGroup = allNewsgroupIterator(False, &left))) {
	  if (in_place) {
	    currentMode(AllGroupsString, &current_group, &old_status, left);
	    if ((old_status != status) &&
		((old_status == IGNORE) || (status == IGNORE)) &&
		(! AllStatus))
	      in_place = False;
	  }
	    ret = GOOD_GROUP;
	    if (status == IGNORE)
		ret = ignoreGroup(newGroup);
	    else if (first || last || group) {
		if (oldGroup)
		    (void) addToNewsrcAfterGroup(newGroup, oldGroup, status);
		else if (first)
		    (void) addToNewsrcBeginning(newGroup, status);
		else if (last)
		    (void) addToNewsrcEnd(newGroup, status);
		else
		    (void) addToNewsrcAfterGroup(newGroup, group, status);
		if (oldGroupSize < (len = (strlen(newGroup) + 1))) {
		    oldGroupSize = len;
		    oldGroup = XtRealloc(oldGroup, oldGroupSize);
		}
		(void) strcpy(oldGroup, newGroup);
	    }
	    else {
		if ((ret = enterNewsgroup(newGroup, ENTER_UNSUBBED))
		    == BAD_GROUP) {
		    mesgPane(XRN_SERIOUS, 0, NO_SUCH_NG_DELETED_MSG, newGroup);
		}
		else if (ret != GOOD_GROUP) {
		    mesgPane(XRN_SERIOUS, 0, UNKNOWN_FUNC_RESPONSE_MSG,
			     ret, "enterNewsgroup", "doAll");
		}
		else if (status == SUBSCRIBE) {
		    subscribe();
		}
		else {
		    unsubscribe();
		}
		exitNewsgroup();
	    }
	    if ((ret == GOOD_GROUP) && in_place)
		markAllString(AllGroupsString, left,
			      (status == IGNORE) ? IGNORED_MSG :
			      ((status == SUBSCRIBE) ? SUBED_MSG : UNSUBED_MSG));
	}
	if (in_place) {
	    updateAllWidget(AllGroupsString, first_left, left);
	}
	else
	    redrawAllWidget();
    }

    XtFree(oldGroup);
    XtFree(current_group);
}


/*
 * Make the selected group(s) subscribed to, and leave them in
 * their current position in the newsrc file.
 */
/*ARGSUSED*/
void allSubFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    doAll(SUBSCRIBE, False, False, 0);
}

/*
 * Mark the selected group(s) as subscribed to, and move them to the
 * beginning of the newsrc file.
 */
/*ARGSUSED*/
void allFirstFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    doAll(SUBSCRIBE, True, False, 0);
}


/*
 * Mark the selected group(s) as subscribed to, and move them
 * to the end of the newsrc file.
 */
/*ARGSUSED*/
void allLastFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    doAll(SUBSCRIBE, False, True, 0);
}

static Widget AllBox = (Widget) 0;

/*
 * Mark the selected group(s) as subscribed to, and place them
 * after the group name (entered in the dialog box) in the newsrc file.
 */
static void allHandler _ARGUMENTS((Widget, XtPointer, XtPointer));

/*ARGSUSED*/
static void allHandler(widget, client_data, call_data)
    Widget widget;
    XtPointer client_data;
    XtPointer call_data;
{
    if (inCommand) {
	return;
    }
    inCommand = 1;
    xrnBusyCursor();

    if ((int) client_data != XRN_CB_ABORT)
	doAll(SUBSCRIBE, False, False, GetDialogValue(AllBox));

    PopDownDialog(AllBox);
    AllBox = 0;
    xrnUnbusyCursor();
    inCommand = 0;
    return;
}

/*
 * Put up a dialog box for the user to enter a group name after which
 * the selected articles should be placed.
 */
/*ARGSUSED*/
void allAfterFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    static struct DialogArg args[] = {
      {ABORT_STRING,     allHandler, (XtPointer) XRN_CB_ABORT},
      {SUB_STRING, allHandler, (XtPointer) XRN_CB_CONTINUE},
    };

    if (CurrentMode != ALL_MODE) {
	return;
    }

    if (AllBox == (Widget) 0) {
      AllBox = CreateDialog(TopLevel, BEHIND_WHAT_GROUP_MSG ,
				  DIALOG_TEXT, args, XtNumber(args));
    }
    PopUpDialog(AllBox);
    return;
}

/*
 * Mark the selected group(s) as unsubscribed, leaving their position
 * in the newsrc file unchanged.
 */
/*ARGSUSED*/
void allUnsubFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    doAll(UNSUBSCRIBE, False, False, 0);
}

/*
 * Mark the selected group(s) as ignored, removing them from the
 * newsrc file.
 */
/*ARGSUSED*/
void allIgnoreFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    if (! app_resources.fullNewsrc)
	doAll(IGNORE, False, False, 0);
}

/*
 * called when the user wants to scroll the all groups window
 */
/*ARGSUSED*/
void allScrollFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    if (CurrentMode != ALL_MODE) {
	return;
    }
    TextScrollPage(AllText, FORWARD);
    return;
}

/*
 * called when the user wants to scroll the all groups window
 */
/*ARGSUSED*/
void allScrollBackFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    if (CurrentMode != ALL_MODE) {
	return;
    }
    TextScrollPage(AllText, BACK);
    return;
}

/*
  Search the group list, using the search functionality built into the Text
  widget.
  */
void allSearchFunction(widget, event, string, count)
     Widget widget;
     XEvent *event;
     String *string;
     Cardinal *count;
{
  if (CurrentMode != ALL_MODE)
    return;

  TextSearchInteractive(AllText,
			event ? event : XtLastEventProcessed(XtDisplay(widget)),
			-1, TextSearchRight,
			(count && *count) ? string[0] : NULL);
}

static Widget LimitBox = (Widget) 0;

static void limitHandler _ARGUMENTS((Widget, XtPointer, XtPointer));

/*ARGSUSED*/
static void limitHandler(widget, client_data, call_data)
    Widget widget;
    XtPointer client_data;
    XtPointer call_data;
{
    if (inCommand)
      return;

    inCommand = 1;
    xrnBusyCursor();

    if (strcmp(DOIT_STRING, (char *) client_data) == 0) {
      FREE(LimitString);

      if ((LimitString = GetDialogValue(LimitBox)))
	if (! *LimitString)
	  LimitString = NULL;
	else
	  LimitString = XtNewString(LimitString);

      redrawAllWidget();
    }
    
    if (LimitBox) {
      PopDownDialog(LimitBox);
      LimitBox = 0;
    }

    inCommand = 0;
    xrnUnbusyCursor();
    return;
}

/*ARGSUSED*/
void allLimitFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    static struct DialogArg args[] = {
      {ABORT_STRING,limitHandler, (XtPointer) ABORT_STRING},
      {DOIT_STRING, limitHandler, (XtPointer) DOIT_STRING},
    };

    if (CurrentMode != ALL_MODE) {
	return;
    }
    if (LimitBox == (Widget) 0) {
      LimitBox = CreateDialog(TopLevel, REGULAR_EXPR_MSG,
			      DIALOG_TEXT, args, XtNumber(args));
    }
    PopUpDialog(LimitBox);
    return;
}

/*
 * Go to the current newsgroup.  The current
 * group is either the first group of a selection,
 * or, if there is no selection, the group the cursor
 * is currently on (if any).
 */
/*ARGSUSED*/
void allGotoFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    int ret;
    String newGroup;

    if (CurrentMode != ALL_MODE) {
	return;
    }

    /* get the current group name */

    if (! (allNewsgroupIterator(True, 0) &&
	   (newGroup = allNewsgroupIterator(False, 0))))
	goto done;

    /* jump to the newsgroup */

    ret = enterNewsgroup(newGroup, ENTER_SETUP | ENTER_UNSUBBED);
    if (ret == XRN_NOUNREAD) {
	mesgPane(XRN_INFO, 0, DISPLAYING_LAST_UNREAD_MSG, newGroup);
	ret = GOOD_GROUP;
    }

    if (ret == GOOD_GROUP) {
	LastGroup = XtRealloc(LastGroup, strlen(newGroup) + 1);
	(void) strcpy(LastGroup, newGroup);

	FREE(AllGroupsString);
	switchToArticleMode();
    }
    else if (ret == BAD_GROUP) {
	mesgPane(XRN_SERIOUS, 0, NO_SUCH_NG_DELETED_MSG, newGroup);
    }
    else if (ret == XRN_NOMORE) {
	mesgPane(XRN_SERIOUS, 0, NO_ARTICLES_MSG, newGroup);
    }
    else {
	mesgPane(XRN_SERIOUS, 0, UNKNOWN_FUNC_RESPONSE_MSG, ret,
		 "enterNewsgroup", "allGotoFunction");
    }

  done:
    return;
}


/*
 * Post to the current newsgroup, possibly with mailing as well.  The
 * current group is either the first group of a selection, or, if
 * there is no selection, the group the cursor is currently on (if
 * any).
 */
/*ARGSUSED*/
static void my_post_function(mail_too)
    Boolean mail_too;
{
    String newGroup;
    int ret;

    if (CurrentMode != ALL_MODE) {
	goto done;
    }

    /* get the current group name */

    if (! (allNewsgroupIterator(True, 0) &&
	   (newGroup = allNewsgroupIterator(False, 0))))
	goto done;

    if ((ret = enterNewsgroup(newGroup, ENTER_UNSUBBED)) == GOOD_GROUP) {
	if (mail_too)
	    post_and_mail(True);
	else
	    post(True);
	exitNewsgroup();
    }
    else if (ret == BAD_GROUP) {
	mesgPane(XRN_SERIOUS, 0, NO_SUCH_NG_DELETED_MSG, newGroup);
    }
    else {
	mesgPane(XRN_SERIOUS, 0, UNKNOWN_FUNC_RESPONSE_MSG, ret,
		 "enterNewsgroup", "my_post_function");
    }

  done:
    return;
}


void allPostFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    if (CurrentMode != ALL_MODE)
	return;

    my_post_function(False);
}

void allPostAndMailFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    if (CurrentMode != ALL_MODE)
	return;
    my_post_function(True);
}


/*
  Send mail.
  */
void allMailFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    if (CurrentMode != ALL_MODE)
	return;

    mail();
}


/*
 * Make note of the groups that were selected
 * to be moved.
 */
/*ARGSUSED*/
void allSelectFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    if (CurrentMode != ALL_MODE) {
	return;
    }

    if (TextGetSelectedOrCurrentLines(AllText, &First, &Last))
	TextUnsetSelection(AllText);

    setButtonSensitive(AllButtonBox, "allMove", First != Last);

    return;
}

/*
 * Move the groups in the last selection to
 * the current cursor position (before the
 * current selection).
 */
/*ARGSUSED*/
void allMoveFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    char *newGroup = 0;
    char *oldGroup = 0;
    int oldGroupSize = 0;
    int status = SUBSCRIBE;
    int dummy;
    char *newString;
    long left, right;
    long stringPoint;
    long cursorSpot;
    long ngGroupPosition;

    if (CurrentMode != ALL_MODE) {
	return;
    }
    if (First == Last) {
	mesgPane(XRN_INFO, 0, NO_GROUPS_SELECTED_MSG);
	return;
    }

    buildString(&newString, First, Last, AllGroupsString);
    stringPoint = 0;
    if (TextGetSelectedOrCurrentLines(AllText, &left, &right))
	TextUnsetSelection(AllText);
    if ((left >= First) && (left <= Last+1)) {
	mesgPane(XRN_SERIOUS, 0, NG_NOT_MOVED_MSG);
	return;
    }
    ngGroupPosition = cursorSpot = left;
    do {
	currentMode(newString, &newGroup, &status, stringPoint);
    } while ((status == IGNORE) &&
	     moveCursor(FORWARD, newString, &stringPoint));
    if (status != IGNORE) {
	if (!moveCursor(BACK, AllGroupsString, &left)) {
	    (void) addToNewsrcBeginning(newGroup, status);
	    if (oldGroupSize < (dummy = (strlen(newGroup) + 1))) {
		oldGroupSize = dummy;
		oldGroup = XtRealloc(oldGroup, oldGroupSize);
	    }
	    (void) strcpy(oldGroup, newGroup);
	    (void) moveCursor(FORWARD, newString, &stringPoint);
	} else {
	    currentMode(AllGroupsString, &oldGroup, &dummy, left);
	    oldGroupSize = strlen(oldGroup) + 1;
	    (void) addToNewsrcAfterGroup(newGroup, oldGroup, status);
	    if (oldGroupSize < (dummy = (strlen(newGroup) + 1))) {
		oldGroupSize = dummy;
		oldGroup = XtRealloc(oldGroup, oldGroupSize);
	    }
	    (void) strcpy(oldGroup, newGroup);
	    (void) moveCursor(FORWARD, newString, &stringPoint);
	}
	while (newString[stringPoint] != '\0') {
	    currentMode(newString, &newGroup, &status, stringPoint);
	    if (status != IGNORE) {
		(void) addToNewsrcAfterGroup(newGroup, oldGroup, status);
		if (oldGroupSize < (dummy = (strlen(newGroup) + 1))) {
		    oldGroupSize = dummy;
		    oldGroup = XtRealloc(oldGroup, oldGroupSize);
		}
		(void) strcpy(oldGroup, newGroup);
	    }
	    if (!moveCursor(FORWARD, newString, &stringPoint)) {
		break;
	    }
	}
    }
    redrawAllWidget();
    XtFree(oldGroup);
    XtFree(newGroup);
    return;
}

/*
 * Change the order the groups appear on the screen.
 */
/*ARGSUSED*/
void allToggleFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    if (CurrentMode != ALL_MODE) {
	return;
    }

    AllStatus = (AllStatus == 0) ? 1 : 0;

    redrawAllWidget();

    return;
}

static void resizeAllText _ARGUMENTS((Widget, XtPointer, XEvent *,
				      Boolean *));

static void resizeAllText(widget, client_data, event,
			  continue_to_dispatch)
     Widget widget;
     XtPointer client_data;
     XEvent *event;
     Boolean *continue_to_dispatch;
{
  if (event->type == ConfigureNotify) {
    redrawAllWidget();
  }
}

void displayAllWidgets()
{
    if (! AllFrame) {
	AllFrame = XtCreateManagedWidget("allFrame", panedWidgetClass,
					 TopLevel, 0, 0);

	XawPanedSetRefigureMode(AllFrame, False);

	setButtonActive(AllButtonList, "allPost", PostingAllowed);
	setButtonActive(AllButtonList, "allPostAndMail", PostingAllowed);
	if (app_resources.fullNewsrc)
	  setButtonActive(AllButtonList, "allIgnore", False);

#define BUTTON_BOX() {\
	  AllButtonBox = ButtonBoxCreate("buttons", AllFrame);\
	  doButtons(app_resources.allButtonList, AllButtonBox,\
		    AllButtonList, &AllButtonListCount, TOP);\
	}

#define INFO_LINE() {\
	  AllInfoLine = InfoLineCreate("info", 0, AllFrame);\
	}

	if (app_resources.buttonsOnTop) {
	  BUTTON_BOX();
	  INFO_LINE();
	}

	AllText = TextCreate("list", True, AllFrame);

	if (! app_resources.buttonsOnTop) {
	  INFO_LINE();
	  BUTTON_BOX();
	}

#undef BUTTON_BOX
#undef INFO_LINE

	TextSetLineSelections(AllText);
	TextDisableWordWrap(AllText);

	TopInfoLine = AllInfoLine;

	XawPanedSetRefigureMode(AllFrame, True);

	XtSetKeyboardFocus(AllFrame, AllText);

	XtAddEventHandler(AllText, StructureNotifyMask, FALSE,
			  resizeAllText, NULL);
    }
    else {
	TopInfoLine = AllInfoLine;
	XtManageChild(AllFrame);
    }
}

void hideAllWidgets()
{
    XtUnmanageChild(AllFrame);
}

void allDoTheRightThing(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    allScrollFunction(widget, event, string, count);
}

void allNextFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    if (CurrentMode != ALL_MODE)
	return;

    TextMoveLine(AllText, FORWARD);
}

void allPrevFunction(widget, event, string, count)
    Widget widget;
    XEvent *event;
    String *string;
    Cardinal *count;
{
    if (CurrentMode != ALL_MODE)
	return;

    TextMoveLine(AllText, BACK);
}