dthelp: Change to ANSI function definitions
[oweals/cde.git] / cde / programs / dtmail / dtmail / DmxPrintOutput.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $TOG: DmxPrintOutput.C /main/6 1997/07/07 13:57:21 mgreess $ */
24
25 /*
26  *+SNOTICE
27  *
28  *      $:$
29  *
30  *      RESTRICTED CONFIDENTIAL INFORMATION:
31  *      
32  *      The information in this document is subject to special
33  *      restrictions in a confidential disclosure agreement between
34  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
35  *      document outside HP, IBM, Sun, USL, SCO, or Univel without
36  *      Sun's specific written approval.  This document and all copies
37  *      and derivative works thereof must be returned or destroyed at
38  *      Sun's request.
39  *
40  *      Copyright 1994 Sun Microsystems, Inc.  All rights reserved.
41  *
42  *+ENOTICE
43  */
44 /*
45  *                   Common Desktop Environment
46  *
47  *   (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
48  *   (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
49  *   (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
50  *   (c) Copyright 1993, 1994, 1995 Novell, Inc.
51  *   (c) Copyright 1995 Digital Equipment Corp.
52  *   (c) Copyright 1995 Fujitsu Limited
53  *   (c) Copyright 1995 Hitachi, Ltd.
54  *                                                                   
55  *
56  *                     RESTRICTED RIGHTS LEGEND                              
57  *
58  *Use, duplication, or disclosure by the U.S. Government is subject to
59  *restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
60  *Technical Data and Computer Software clause in DFARS 252.227-7013.  Rights
61  *for non-DOD U.S. Government Departments and Agencies are as set forth in
62  *FAR 52.227-19(c)(1,2).
63
64  *Hewlett-Packard Company, 3000 Hanover Street, Palo Alto, CA 94304 U.S.A.
65  *International Business Machines Corp., Route 100, Somers, NY 10589 U.S.A. 
66  *Sun Microsystems, Inc., 2550 Garcia Avenue, Mountain View, CA 94043 U.S.A.
67  *Novell, Inc., 190 River Road, Summit, NJ 07901 U.S.A.
68  *Digital Equipment Corp., 111 Powdermill Road, Maynard, MA 01754, U.S.A.
69  *Fujitsu Limited, 1015, Kamikodanaka Nakahara-Ku, Kawasaki 211, Japan
70  *Hitachi, Ltd., 6, Kanda Surugadai 4-Chome, Chiyoda-ku, Tokyo 101, Japan
71  */
72
73
74 #include <stdio.h>
75 #include <X11/Intrinsic.h>
76 #include <Xm/Xm.h>
77 #include <Xm/DialogS.h>
78 #include <Xm/Form.h>
79 #include <Xm/Label.h>
80 #if 0 && defined(PRINTING_SUPPORTED)
81 #include <Xm/Print.h>
82 #endif /* PRINTING_SUPPORTED */
83 #include <Xm/Text.h>
84 #include <Dt/Editor.h>
85
86 #include "Dmx.h"
87 #include "DmxPrintOutput.h"
88 #include "RoamMenuWindow.h"
89
90 //
91 // Used to initialize the top, right, bottom, and left margins
92 // between the outside edge of the page (_form) and the inner
93 // page that is written on.
94 //
95 const char *const DmxPrintOutput::_default_margin = ".5in";
96
97 DmxPrintOutput::DmxPrintOutput (
98                                 Widget pshell
99                                 ) : UIComponent( "PrintOutput" )
100 {
101     Widget              w;
102     DtMailBoolean       parse_error;
103
104     _w = NULL;
105     _pshell = pshell;
106
107     w = XtVaCreateWidget("Page",
108                         xmFormWidgetClass,
109                         _pshell,
110                         XmNresizePolicy, XmRESIZE_NONE,
111                         NULL);
112     _form = w;
113     _w = _form;
114                  
115     w = XtVaCreateWidget("InnerPage",
116                         xmFormWidgetClass,
117                         _form,
118                         XmNresizePolicy, XmRESIZE_NONE,
119                         NULL);
120     _inner_form = w;
121                  
122     w = XtVaCreateManagedWidget("HeaderLeft",
123                                   xmLabelWidgetClass,
124                                   _inner_form,
125                                   XmNalignment, XmALIGNMENT_BEGINNING,
126                                   XmNleftAttachment, XmATTACH_FORM,
127                                   XmNtopAttachment, XmATTACH_FORM,
128                                   NULL);
129     _header_left = w;
130
131     w = XtVaCreateManagedWidget("HeaderRight",
132                                   xmLabelWidgetClass,
133                                   _inner_form,
134                                   XmNalignment, XmALIGNMENT_END,
135                                   XmNrightAttachment, XmATTACH_FORM,
136                                   XmNleftAttachment, XmATTACH_WIDGET,
137                                   XmNleftWidget, _header_left,
138                                   XmNtopAttachment, XmATTACH_FORM,
139                                   NULL);
140     _header_right = w;
141                  
142     w = XtVaCreateManagedWidget("Editor",
143 #ifdef USE_DTEDITOR
144                                   dtEditorWidgetClass,
145 #else
146                                   xmTextWidgetClass,
147 #endif
148                                   _inner_form,
149                                   DtNscrollVertical, FALSE,
150                                   DtNscrollHorizontal, FALSE,
151                                   DtNshowStatusLine, FALSE,
152                                   DtNwordWrap, TRUE,
153                                   XmNeditMode, XmMULTI_LINE_EDIT,
154                                   XmNleftAttachment, XmATTACH_FORM,
155                                   XmNrightAttachment, XmATTACH_FORM,
156                                   XmNtopAttachment, XmATTACH_WIDGET,
157                                   XmNtopWidget, _header_left,
158                                   NULL);
159     _editor = w;
160                  
161     w = XtVaCreateManagedWidget("FooterLeft",
162                                   xmLabelWidgetClass,
163                                   _inner_form,
164                                   XmNalignment, XmALIGNMENT_BEGINNING,
165                                   XmNleftAttachment, XmATTACH_FORM,
166                                   XmNbottomAttachment, XmATTACH_FORM,
167                                   NULL);
168     _footer_left = w;
169
170     w = XtVaCreateManagedWidget("FooterRight",
171                                   xmLabelWidgetClass,
172                                   _inner_form,
173                                   XmNalignment, XmALIGNMENT_END,
174                                   XmNleftAttachment, XmATTACH_WIDGET,
175                                   XmNleftWidget, _footer_left,
176                                   XmNrightAttachment, XmATTACH_FORM,
177                                   XmNbottomAttachment, XmATTACH_FORM,
178                                   NULL);
179     _footer_right = w;
180
181     XtVaSetValues(
182                 _editor,
183                 XmNbottomAttachment, XmATTACH_WIDGET,
184                 XmNbottomWidget, _footer_left,
185                 NULL);
186
187     installDestroyHandler();
188     XtManageChild(_inner_form);
189     XtManageChild(_form);
190
191     setPageMargins(
192                 _default_margin,
193                 _default_margin,
194                 _default_margin,
195                 _default_margin,
196                 &parse_error );
197     assert(!parse_error);
198 }
199
200 DmxPrintOutput::~DmxPrintOutput (void)
201 {
202     //
203     //  Don't destroy anything here.
204     //  The BasicComponent class takes care of destroying
205     //  the _form widget.
206     //
207 }
208
209 void DmxPrintOutput::hideFooters (void)
210 {
211     XtUnmanageChild(_footer_left);
212     XtUnmanageChild(_footer_right);
213     XtVaSetValues(_editor, XmNbottomAttachment, XmATTACH_FORM, NULL);
214 }
215
216 void DmxPrintOutput::showFooters (void)
217 {
218     XtManageChild(_footer_left);
219     XtManageChild(_footer_right);
220     XtVaSetValues(
221                 _editor,
222                 XmNbottomAttachment, XmATTACH_WIDGET,
223                 XmNbottomWidget, _footer_left,
224                 NULL);
225 }
226
227 void DmxPrintOutput::hideHeaders (void)
228 {
229     XtUnmanageChild(_header_left);
230     XtUnmanageChild(_header_right);
231     XtVaSetValues(_editor, XmNtopAttachment, XmATTACH_FORM, NULL);
232 }
233
234 void DmxPrintOutput::showHeaders (void)
235 {
236     XtManageChild(_header_left);
237     XtManageChild(_header_right);
238     XtVaSetValues(
239                 _editor,
240                 XmNtopAttachment, XmATTACH_WIDGET,
241                 XmNtopWidget, _header_left,
242                 NULL);
243 }
244
245
246 void
247 DmxPrintOutput::setHdrFtrString (_DtPrintHdrFtrEnum which, char *label)
248 {
249     Widget      w;
250     XmString    xms;
251
252     if (label == (char *) NULL)
253       return;
254
255     switch (which)
256     {
257         case DTPRINT_OPTION_HEADER_LEFT:
258           w = _header_left;
259           break;
260         case DTPRINT_OPTION_HEADER_RIGHT:
261           w = _header_right;
262           break;
263         case DTPRINT_OPTION_FOOTER_LEFT:
264           w = _footer_left;
265           break;
266         case DTPRINT_OPTION_FOOTER_RIGHT:
267           w = _footer_right;
268           break;
269         default:
270           // TBD:  Need to log an error.
271           return;
272     }
273
274     xms = XmStringCreateLocalized(label);
275     XtVaSetValues(w, XmNlabelString, xms, NULL);
276     XmStringFree(xms);
277 }
278
279 void
280 DmxPrintOutput::setHdrFtrStrings (
281                                 char *hdr_left,
282                                 char *hdr_right,
283                                 char *ftr_left,
284                                 char *ftr_right
285                                    )
286 {
287     XmString    xms;
288
289     if (hdr_left)
290     {
291         xms = XmStringCreateLocalized(hdr_left);
292         XtVaSetValues(_header_left, XmNlabelString, xms, NULL);
293         XmStringFree(xms);
294     }
295
296     if (hdr_right)
297     {
298         xms = XmStringCreateLocalized(hdr_right);
299         XtVaSetValues(_header_right, XmNlabelString, xms, NULL);
300         XmStringFree(xms);
301     }
302
303     if (ftr_left)
304     {
305         xms = XmStringCreateLocalized(ftr_left);
306         XtVaSetValues(_footer_left, XmNlabelString, xms, NULL);
307         XmStringFree(xms);
308     }
309
310     if (ftr_right)
311     {
312         xms = XmStringCreateLocalized(ftr_right);
313         XtVaSetValues(_footer_right, XmNlabelString, xms, NULL);
314         XmStringFree(xms);
315     }
316 }
317
318 void
319 DmxPrintOutput::setPageMargin (
320                                 _DtPrintMarginEnum which,
321                                 const char *margin,
322                                 DtMailBoolean *parse_error
323                                 )
324 {
325     int         pixels = 0;
326     XtEnum      xt_parse_error = FALSE;
327     char        *marginstring = strdup(margin);
328
329     if (parse_error)
330       *parse_error = DTM_FALSE;
331
332     switch (which)
333     {
334         case DTPRINT_OPTION_MARGIN_TOP:
335           pixels = XmConvertStringToUnits(
336                                         XtScreenOfObject(_pshell),
337                                         marginstring,
338                                         XmVERTICAL,
339                                         XmPIXELS,
340                                         &xt_parse_error);
341           if (!xt_parse_error && pixels > 0)
342             _margin_top = pixels;
343           break;
344         case DTPRINT_OPTION_MARGIN_RIGHT:
345           pixels = XmConvertStringToUnits(
346                                         XtScreenOfObject(_pshell),
347                                         marginstring,
348                                         XmHORIZONTAL,
349                                         XmPIXELS,
350                                         &xt_parse_error);
351           if (!xt_parse_error && pixels > 0)
352             _margin_right = pixels;
353           break;
354         case DTPRINT_OPTION_MARGIN_BOTTOM:
355           _margin_bottom = pixels;
356           pixels = XmConvertStringToUnits(
357                                         XtScreenOfObject(_pshell),
358                                         marginstring,
359                                         XmVERTICAL,
360                                         XmPIXELS,
361                                         &xt_parse_error);
362           if (!xt_parse_error && pixels > 0)
363             _margin_bottom = pixels;
364           break;
365         case DTPRINT_OPTION_MARGIN_LEFT:
366           pixels = XmConvertStringToUnits(
367                                         XtScreenOfObject(_pshell),
368                                         marginstring,
369                                         XmHORIZONTAL,
370                                         XmPIXELS,
371                                         &xt_parse_error);
372           if (!xt_parse_error && pixels > 0)
373             _margin_left = pixels;
374           break;
375         default:
376           // TBD:  Need to log an error.
377           return;
378     }
379
380     if (!xt_parse_error)
381       setInnerPageDimensions(
382                         _margin_top,
383                         _margin_right,
384                         _margin_bottom,
385                         _margin_left);
386     else
387       *parse_error = DTM_TRUE;
388
389     free(marginstring);
390 }
391
392 void
393 DmxPrintOutput::setPageMargin (_DtPrintMarginEnum which, int margin)
394 {
395     Dimension   pixels = (Dimension) margin;
396
397     switch (which)
398     {
399         case DTPRINT_OPTION_MARGIN_TOP:
400           _margin_top = pixels;
401           break;
402         case DTPRINT_OPTION_MARGIN_RIGHT:
403           _margin_right = pixels;
404           break;
405         case DTPRINT_OPTION_MARGIN_BOTTOM:
406           _margin_bottom = pixels;
407           break;
408         case DTPRINT_OPTION_MARGIN_LEFT:
409           _margin_left = pixels;
410           break;
411         default:
412           // TBD:  Need to log an error.
413           return;
414     }
415
416     setInnerPageDimensions(
417                         _margin_top,
418                         _margin_right,
419                         _margin_bottom,
420                         _margin_left);
421 }
422
423 void
424 DmxPrintOutput::setPageMargins (
425                                 const char *top,
426                                 const char *right,
427                                 const char *bottom,
428                                 const char *left,
429                                 DtMailBoolean *parse_error
430                                  )
431 {
432     int         pixels = 0;
433     XtEnum      xt_parse_error = FALSE;
434     char        *margin;
435
436     *parse_error = DTM_FALSE;
437
438     margin = strdup(top);
439     pixels = XmConvertStringToUnits(
440                                 XtScreenOfObject(_pshell),
441                                 margin,
442                                 XmVERTICAL,
443                                 XmPIXELS,
444                                 &xt_parse_error);
445     free(margin);
446     if (!xt_parse_error && pixels > 0)
447     {
448         _margin_top = pixels;
449     }
450     else
451     {    
452         *parse_error = DTM_TRUE;
453         return;
454     }
455
456     margin = strdup(right);
457     pixels = XmConvertStringToUnits(
458                                 XtScreenOfObject(_pshell),
459                                 margin,
460                                 XmHORIZONTAL,
461                                 XmPIXELS,
462                                 &xt_parse_error);
463     free(margin);
464     if (!xt_parse_error && pixels > 0)
465     {
466         _margin_right = pixels;
467     }
468     else
469     {    
470         *parse_error = DTM_TRUE;
471         return;
472     }
473
474     margin = strdup(bottom);
475     pixels = XmConvertStringToUnits(
476                                 XtScreenOfObject(_pshell),
477                                 margin,
478                                 XmVERTICAL,
479                                 XmPIXELS,
480                                 &xt_parse_error);
481     free(margin);
482     if (!xt_parse_error && pixels > 0)
483     {
484         _margin_bottom = pixels;
485     }
486     else
487     {    
488         *parse_error = DTM_TRUE;
489         return;
490     }
491
492     margin = strdup(left);
493     pixels = XmConvertStringToUnits(
494                                 XtScreenOfObject(_pshell),
495                                 margin,
496                                 XmHORIZONTAL,
497                                 XmPIXELS,
498                                 &xt_parse_error);
499     free(margin);
500     if (!xt_parse_error && pixels > 0)
501     {
502         _margin_left = pixels;
503     }
504     else
505     {    
506         *parse_error = DTM_TRUE;
507         return;
508     }
509
510     setInnerPageDimensions(
511                         _margin_top,
512                         _margin_right,
513                         _margin_bottom,
514                         _margin_left);
515 }
516
517 void
518 DmxPrintOutput::setPageMargins (
519                                 int top,
520                                 int right,
521                                 int bottom,
522                                 int left
523                                  )
524 {
525     _margin_top = (top > 0) ? (Dimension) top : _margin_top;
526     _margin_right = (right > 0) ? (Dimension) right : _margin_right;
527     _margin_bottom = (bottom > 0) ? (Dimension) bottom : _margin_bottom;
528     _margin_left = (left > 0) ? (Dimension) left : _margin_left;
529
530     setInnerPageDimensions(
531                         _margin_top,
532                         _margin_right,
533                         _margin_bottom,
534                         _margin_left);
535 }
536
537 void
538 DmxPrintOutput::setWrapToFit (DtMailBoolean onoff)
539 {
540 #ifdef USE_DTEDITOR
541     XtVaSetValues(_editor, DtNwordWrap, onoff, NULL);
542 #else
543     XtVaSetValues(_editor, XmNwordWrap, onoff, NULL);
544 #endif
545 }
546
547
548
549 int DmxPrintOutput::getCharactersPerLine ()
550 {
551     XtArgVal    columns = 0;
552
553 #ifdef USE_DTEDITOR
554     XtVaGetValues(_editor, DtNcolumns, &columns, NULL);
555 #else
556     XtVaGetValues(_editor, XmNcolumns, &columns, NULL);
557 #endif
558     return((int) columns);
559 }
560
561
562
563 int DmxPrintOutput::getNumLines ()
564 {
565     XtArgVal    total = 0;
566
567 #ifdef USE_DTEDITOR
568 #else
569     XtVaGetValues(_editor, XmNtotalLines, &total, NULL);
570     //
571     // Correct for off by one error.
572     //
573     total -= 1;
574 #endif
575     return((int)total);
576 }
577
578
579 int DmxPrintOutput::getLastPosition ()
580 {
581     XmTextPosition last;
582
583 #ifdef USE_DTEDITOR
584     last = DtEditorGetLastPosition(_editor);
585 #else
586     last = XmTextGetLastPosition(_editor);
587 #endif
588     return((int) last);
589 }
590
591 int DmxPrintOutput::getTopPosition ()
592 {
593     XmTextPosition top;
594
595 #ifdef USE_DTEDITOR
596     XtVaGetValues(_editor, DtNtopCharacter, &top, NULL);
597 #else
598     top = XmTextGetTopCharacter(_editor);
599 #endif
600     return((int) top);
601 }
602
603 DtMailBoolean DmxPrintOutput::pageUp ()
604 {
605     XmTextPosition top_before, top_after;
606
607 #ifdef USE_DTEDITOR
608     return DTM_FALSE;
609 #else
610     top_before = XmTextGetTopCharacter(_editor);
611     XmTextScroll(_editor, -1 * _lines_per_page);
612     top_after = XmTextGetTopCharacter(_editor);
613
614     return (top_before > top_after) ? DTM_TRUE : DTM_FALSE;
615 #endif
616 }
617
618 DtMailBoolean DmxPrintOutput::pageDown ()
619 {
620     XmTextPosition top_before, top_after;
621
622 #ifdef USE_DTEDITOR
623     return DTM_FALSE;
624 #else
625     top_before = XmTextGetTopCharacter(_editor);
626     XmTextScroll(_editor, _lines_per_page);
627     top_after = XmTextGetTopCharacter(_editor);
628
629     return (top_before < top_after) ? DTM_TRUE : DTM_FALSE;
630 #endif
631 }
632
633 void DmxPrintOutput::setTopPosition ( int pos )
634 {
635     XmTextPosition top = (XmTextPosition) pos;
636
637 #ifdef USE_DTEDITOR
638     XtVaSetValues(_editor, DtNtopCharacter, top, NULL);
639 #else
640     XmTextSetTopCharacter(_editor, top);
641 #endif
642 }
643
644 void DmxPrintOutput::appendContents (void* stream, char *contents)
645 {
646     DmxPrintOutput      *thisOutput = (DmxPrintOutput *) stream;
647
648 #ifdef USE_DTEDITOR
649     DtEditorContentRec  rec;
650
651     rec.type = DtEDITOR_TEXT;
652     rec.value.string = contents;
653     DtEditorInsert(thisOutput->_editor, &rec);
654 #else
655     XmTextPosition pos;
656
657     pos = XmTextGetLastPosition(thisOutput->_editor);
658     XmTextInsert(thisOutput->_editor, pos, contents);
659 #endif
660 }
661
662 void DmxPrintOutput::appendNewLine ()
663 {
664 #ifdef PRINT_TO_VIDEO 
665     char        *contents = "=========== NewLine ==========\n";
666 #else
667     char        *contents = "\n";
668 #endif
669     appendContents((XtPointer) this, contents);
670 }
671
672 void DmxPrintOutput::appendPageBreak ()
673 {
674     char *      buf;
675     char        *contents = "\n";
676     int         nlines, missing;
677
678     nlines = getNumLines();
679     missing = ((nlines % _lines_per_page) > 0) ?
680                 (_lines_per_page - (nlines % _lines_per_page)) :
681                 0;
682
683     if (! missing)
684       return;
685     
686 #ifdef PRINT_TO_VIDEO 
687     for (int i=0; i<missing; i++)
688     {
689         char    buffer[128];
690
691         sprintf(buffer, "Page Break Line:  %d\n", i);
692         appendContents((XtPointer) this, buffer);
693     }
694     fprintf(
695         stdout,
696         "Total Lines:  %d;  Lines Per Page:  %d;  Missing Lines:  %d\n",
697         nlines,
698         _lines_per_page,
699         missing);
700 #else
701     buf = (char *) malloc((missing * 2) + 1);
702     for (int i=0; i<missing; i++)
703       strcat(buf, contents);
704
705     appendContents(this, contents);
706
707     free(buf);
708 #endif
709 }
710
711 void DmxPrintOutput::clearContents (void)
712 {
713 #ifdef USE_DTEDITOR
714     DtEditorContentRec  content;
715
716     content.type = DtEDITOR_TEXT;
717     rec.value.string = NULL;
718     status = DtEditorSetContents(my_text, &content);
719 #else
720     XmTextSetString(_editor, "");
721 #endif
722 }
723
724
725 /*
726  * Private class methods
727  */
728 int
729 DmxPrintOutput::doGetLinesPerPage ()
730 {
731     XtArgVal /* Dimension */    lpp;
732
733     XtVaGetValues(_editor, XmNrows, &lpp, NULL);
734     return ((int) lpp);
735 }
736
737
738 void
739 DmxPrintOutput::setInnerPageDimensions (
740                                         Dimension top,
741                                         Dimension right,
742                                         Dimension bottom,
743                                         Dimension left
744                                            )
745 {
746     XtArgVal height0, width0;
747     Dimension   inner_height, inner_width, inner_x, inner_y,
748                 outer_height, outer_width,
749                 editor_height, footer_height, header_height;
750
751     XtVaGetValues(_form,
752                   XmNheight, &height0,
753                   XmNwidth, &width0,
754                   NULL);
755     outer_height = (Dimension)height0;
756     outer_width = (Dimension)width0;
757
758     XtVaGetValues(_header_left,
759                   XmNheight, &height0,
760                   NULL);
761     header_height = (Dimension)height0;
762
763     XtVaGetValues(_footer_left,
764                   XmNheight, &height0,
765                   NULL);
766     footer_height = (Dimension)height0;
767
768     inner_x = left;
769     inner_y = top;
770     inner_height = ((int) outer_height > (top + bottom)) ?
771                         (outer_height - (top +  bottom)) :
772                         outer_height;
773     inner_width = ((int) outer_width > (left + right)) ?
774                         (outer_width - (left + right)) :
775                         outer_width;
776     editor_height = ((int) inner_height > (header_height + footer_height)) ?
777                         (inner_height - (header_height + footer_height)) :
778                         inner_height;
779     
780     XtVaSetValues(_editor, XmNheight, editor_height, NULL);
781
782     XtVaSetValues(_inner_form,
783                 XmNleftAttachment, XmATTACH_NONE,
784                 XmNtopAttachment, XmATTACH_NONE,
785                 XmNx, inner_x,
786                 XmNy, inner_y,
787                 XmNheight, inner_height,
788                 XmNwidth, inner_width,
789                 NULL);
790
791     _lines_per_page = doGetLinesPerPage();
792 }