Annotation of researchv9/X11/src/X.V11R1/clients/xedit/util.c, revision 1.1.1.1

1.1       root        1: #ifndef lint
                      2: static char rcs_id[] = "$Header: util.c,v 1.6 87/09/11 08:22:16 toddb Exp $";
                      3: #endif
                      4: 
                      5: /*
                      6:  *                       COPYRIGHT 1987
                      7:  *                DIGITAL EQUIPMENT CORPORATION
                      8:  *                    MAYNARD, MASSACHUSETTS
                      9:  *                     ALL RIGHTS RESERVED.
                     10:  *
                     11:  * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
                     12:  * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
                     13:  * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR
                     14:  * ANY PURPOSE.  IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
                     15:  *
                     16:  * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT RIGHTS,
                     17:  * APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN ADDITION TO THAT
                     18:  * SET FORTH ABOVE.
                     19:  *
                     20:  *
                     21:  * Permission to use, copy, modify, and distribute this software and its
                     22:  * documentation for any purpose and without fee is hereby granted, provided
                     23:  * that the above copyright notice appear in all copies and that both that
                     24:  * copyright notice and this permission notice appear in supporting documentation,
                     25:  * and that the name of Digital Equipment Corporation not be used in advertising
                     26:  * or publicity pertaining to distribution of the software without specific, 
                     27:  * written prior permission.
                     28:  */
                     29: 
                     30: #include "xedit.h"
                     31: 
                     32: XeditPrintf(fmt, arg1, arg2, arg3, arg4)
                     33:   char *fmt;
                     34: {
                     35:   char buf[1024];
                     36:   XtTextBlock text;
                     37:   
                     38:   XtTextPosition pos = (*messsource->scan)(messsource, 0, XtstFile, XtsdRight,1,0);
                     39:     sprintf(buf, fmt, arg1, arg2, arg3, arg4);
                     40:     text.length = strlen(buf);
                     41:     text.ptr = buf;
                     42:     QXtTextReplace(CurDpy, messwindow, pos, pos, &text);
                     43:     QXtTextSetInsertionPoint(CurDpy, messwindow, pos + text.length);
                     44: }
                     45: 
                     46: Window makeCommandButton(box, name, function)
                     47:   Window box;
                     48:   char *name;
                     49:   int (*function)();
                     50: {
                     51:   int numargs;
                     52:   Arg args[3];
                     53:     numargs = 0;
                     54:     MakeArg(XtNlabel, (caddr_t)name);
                     55:     MakeArg(XtNfunction, (caddr_t)function);
                     56:     MakeArg(XtNname, (caddr_t)name);
                     57:     return(QXtCommandCreate(CurDpy, box, args, numargs));
                     58: }
                     59: /*
                     60: Window makeBooleanButton(box, name, value)
                     61:   Window box;
                     62:   char *name;
                     63:   int *value;
                     64: {
                     65:   Arg args[2];
                     66:   int numargs;
                     67:     numargs = 0;
                     68:     MakeArg(XtNlabel, (caddr_t)name);
                     69:     MakeArg(XtNvalue, (caddr_t)value);
                     70:     return(QXtBooleanCreate(CurDpy, box, args, numargs));
                     71: }
                     72: */
                     73: 
                     74: Window makeStringBox(parentBox, string, length)
                     75:   Window parentBox;
                     76:   char *string;
                     77: {
                     78:   XtEditType edittype;
                     79:   Arg args[4];
                     80:   Window StringW;
                     81:   int numargs;
                     82:     numargs = 0;
                     83:     MakeArg(XtNtextOptions, (caddr_t)(/* editable |*/ resizeWidth));
                     84:     MakeArg(XtNeditType, (caddr_t)XttextEdit);
                     85:     MakeArg(XtNstring,(caddr_t)string); 
                     86:     MakeArg(XtNwidth,  (caddr_t)length);
                     87:     StringW = QXtTextStringCreate(CurDpy, parentBox, args, numargs);
                     88:     return(StringW);  
                     89: }
                     90:  
                     91: FixScreen(from)
                     92:     XtTextPosition from;
                     93: {
                     94:     XtTextPosition to;
                     95:     if(from >= 0){
                     96:         to = (*source->getLastPos)(source) + 10;
                     97:        QXtTextInvalidate(CurDpy,textwindow, (from > 0 ) ? from -1 : from, to); 
                     98:        QXtTextSetInsertionPoint(CurDpy, textwindow, from); 
                     99:     } else {
                    100:        Feep();
                    101:     }
                    102: }
                    103: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.