home *** CD-ROM | disk | FTP | other *** search
- /*
- putext.c 7/22/88
-
- % pop_Text
-
- popup text routine.
-
- C-scape 3.2
- Copyright (c) 1986, 1987, 1988, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 8/23/88 jmd Fixed wrap width.
- 9/16/88 jmd updated for 3.0
- 11/05/88 jmd removed menu_Close
-
- 4/22/89 jmd changed border to bord
- 12/18/89 jdc preened
- 3/28/90 jmd ansi-fied
- 12/13/90 jdc preened
- 12/14/90 jdc polished auto-sizing
- */
-
- #include <stdio.h>
- #include <string.h>
-
- #include "cscape.h"
- #include "scancode.h"
- #include "teddecl.h"
- #include "popdecl.h"
-
- sed_type pop_Text(char *msg, int row, int col, int height, int width, byte color, bd_fptr bord)
- /*
- Puts up a message in a box and returns a handle to the message.
- The message can be removed by calling sed_Close.
- */
- {
- sed_type sed;
- menu_type menu;
- int w;
- unsigned int len;
-
- if (msg == NULL) {
- return(NULL);
- }
-
- if ((menu = menu_Open()) == NULL) {
- return(NULL);
- }
- menu_Flush(menu);
- for (len = 0; msg[len] != '\0'; len++) ;
- if (!menu_SetTB(menu, msg, len)) {
- menu_Destroy(menu);
- return(NULL);
- }
-
- if ((sed = sed_Open(menu)) == NULL) {
- menu_Destroy(menu);
- return(NULL);
- }
-
- sed_SetColors(sed, color, color, color);
- sed_SetBorder(sed, bord);
- if (width > 0) {
- w = width;
- }
- else if (popparms.width > 0) {
- w = popparms.width;
- }
- else {
- w = disp_GetWidth() - (bord_GetWidth(sed) - sed_GetWidth(sed));
- if (col > 0) {
- w -= col;
- }
- }
- ted_SetWrapWidth(sed, w);
- menu_SetDirty(menu, TRUE);
- menu_RecalcSize(menu);
-
- pop_SetParms(sed, row, col, height, width, NULL);
-
- sed_Repaint(sed);
-
- return(sed);
- }
-