home *** CD-ROM | disk | FTP | other *** search
- /* ==( help/popup.c )== */
- /* ----------------------------------------------- */
- /* Pro-C Copyright (C) 1988 - 1990 Vestronix Inc. */
- /* Modification to this source is not supported */
- /* by Vestronix Inc. */
- /* All Rights Reserved */
- /* ----------------------------------------------- */
- /* Written JPK 26-Sep-88 */
- /* Modified Geo 12-Dec-89 See comments below */
- /* ----------------------------------------------- */
- /* %W% (%H% %T%) */
-
- /*
- * Modifications
- *
- * 12-Dec-89 Geo - V2 version with variable lines
- * 25-Oct-89 Geo - 1.32 Merge
- *
- *
- */
-
- # include <stdio.h>
- # include <bench.h>
- # include "help.h"
- # include <fileio.h>
-
- # define POP_HEIGHT 7
- # define POP_WIDTH 15
-
- # define RESIZE 0
- # define MOVE 1
- # define EDIT 2
- # define CHANGE 3
- # define SAVE 4
-
-
- static struct optab options[] =
- {
- {2, 2, "Resize window"},
- {3, 2, "Move window "},
- {4, 2, "Edit text "},
- {5, 2, "Change setup "},
- {6, 2, "Save setup "},
- {NORMAL, REVVID, NULL}
- };
-
-
-
- void popup_menu(hptr)
- struct help_hdr * hptr;
- {
- int deleted = 1;
- int command = EDIT;
- int func = EDIT;
- int row;
- int col;
-
- while (lock_index(h_num, WLOK) == FALSE)
- {
- if (!warning(-1, "Help message in use...\n Retry?"))
- return;
- flushscr();
- }
-
- /* popup a menu giving window modification selections */
- do
- {
- if (deleted)
- {
- row = hptr->row + 1;
- row = (row > (w_nrows - POP_HEIGHT) ? w_nrows - POP_HEIGHT : row);
- col = hptr->col + 2;
- col = (col > (w_ncols - POP_WIDTH) ? w_ncols - POP_WIDTH : col);
-
- create_w(row, col, POP_HEIGHT, POP_WIDTH);
- border_w(0, NORMAL);
- deleted = 0;
- }
- command = do_options(options, func, 0);
- if (command >= 0)
- func = command;
-
- switch (command)
- {
- case RESIZE: /* resize the help window */
- delete_w(); /* get rid of popup */
- deleted = 1;
- resize_w(hptr);
- func = MOVE;
- break;
-
- case MOVE: /* move the help window */
- delete_w();
- deleted = 1;
- move_w(hptr);
- func = RESIZE;
- break;
-
- case EDIT:
- /* Order is important here due to redrawing new & old text */
- delete_w();
- deleted = 1;
- invoke_editor();
- return;
-
- case CHANGE:
- change_setup(hptr);
- func = SAVE;
- break;
-
- case SAVE:
- write_hdr(&h_ndx);
- command = -1; /* Quit */
-
- default:
- /* do nothing */
- break;
- }
- } while (command >= 0);
-
- /* delete the popup */
- delete_w();
- if (lock_index(h_num, ULOK) == FALSE)
- errmsg("popup(): free of write lock on index failed");
- if (lock_index(h_num, RLOK) == FALSE)
- errmsg("popup(): read lock on index failed");
- }
-