home *** CD-ROM | disk | FTP | other *** search
- /*
- pumsg.c 1/27/87
-
- % pop_Message
-
- popup message routine.
-
- C-scape 3.2
- Copyright (c) 1986, 1987, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 3/22/88 jmd Added cursor type restoration.
- 7/22/88 jmd Removed cursor type restoration.
- Made it work with windows.
- 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
-
- 3/28/90 jmd ansi-fied
- 8/27/90 jmd added use of popparms_struct
- 10/12/90 jdc moved placement of SetWrapWidth
- 12/14/90 jdc polished auto-sizing
- */
-
- #include <stdio.h>
-
- #include "cscape.h"
- #include "teddecl.h"
- #include "scancode.h"
- #include "popdecl.h"
-
- void pop_Message(char *msg, int row, int col, int height, int width, byte color, bd_fptr bord)
- /*
- Puts up a message in a box and returns.
- If msg is NULL then it clears the previous message.
- */
- {
- static sed_type sed = NULL;
- menu_type menu;
- unsigned int len;
- int w;
-
- if (sed != NULL) {
- /* clear the old message first */
- sed_Close(sed);
- sed = NULL;
- }
-
- if (msg == NULL) {
- return;
- }
-
- if ((menu = menu_Open()) == NULL) {
- return;
- }
-
- for (len = 0; msg[len] != '\0'; len++) ;
- if (!menu_SetTB(menu, msg, len)) {
- menu_Destroy(menu);
- return;
- }
- menu_Flush(menu);
-
- if ((sed = sed_Open(menu)) == NULL) {
- menu_Destroy(menu);
- return;
- }
-
- 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);
- }
-
-
-