home *** CD-ROM | disk | FTP | other *** search
- /*
- demofram.c
-
- C-scape 3.2 Example Program
- Copyright (c) 1989, 1990 by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Example using the framer menuing system with the help system.
-
- All the pulldown menu choices call the function 'empty' defined below.
- This program requires the associated help file DEMOFRAM.HLP
-
- Revision History:
- -----------------
- 4/01/90 jmd ansi-fied
- 6/06/90 jmd changed main to return an int
- 9/14/90 bkd changed to use exit(0) instead of return(0).
- 10/19/90 pmcm included ostdlib.h for exit(), added return(1)
- 12/01/90 ted added oak_notused() macro to suppress warnings.
- 12/01/90 ted prototyped main, except if Turbo C++.
- 12/04/90 ted restored "" includes for C-scape headers (not <> includes).
- */
-
-
- #include <stdio.h>
-
- #include "cscape.h"
- #include "ostdlib.h" /* for exit() */
- #include "popdecl.h" /* the 'empty' function below uses a pop-up */
- #include "helpdecl.h" /* for the help system */
- #include "framer.h" /* for the framer */
-
- /*** Function prototypes ***/
-
- /* Turbo C++ complains if main is prototyped */
- #ifndef TCP
- int main(void);
- #endif
-
- int empty(VOID *sdata, int idata);
-
- /* --------- FRAMER DEFINITION ----------------------------- */
-
- struct frame_def test_frame[] = {
-
- /*
- * menu text, user- idata
- * func, (must be
- * > 0)
- */
-
- { "Help!", FNULL, 1 },
- { "Help!", empty, 101 },
- { "The night before", empty, 103 },
- { "You've got to hide your love away", empty, 104 },
- { "I need you", empty, 105 },
- { "Another girl", empty, 106 },
- { "You're going to lose that girl", empty, 107 },
- { "Ticket to ride", empty, 108 },
- { "Act naturally", empty, 109 },
- { "It's only love", empty, 110 },
- { "You like me too much", empty, 111 },
- { "Tell me what you see", empty, 112 },
- { "I've just seen a face", empty, 113 },
- { "Yesterday", empty, 114 },
- { "Dizzy miss lizzie", empty, 115 },
- { FRAME_END },
-
- { "Rubber Soul", FNULL, 2 },
- { "Drive my car", empty, 201 },
- { "Norwegian wood", empty, 202 },
- { "You won't see me", empty, 203 },
- { "Nowhere man", empty, 204 },
- { "Think for yourself", empty, 205 },
- { "The word", empty, 206 },
- { "Michelle", empty, 207 },
- { "What goes on", empty, 208 },
- { "Girl", empty, 209 },
- { "I'm looking through you", empty, 210 },
- { "In my life", empty, 211 },
- { "Wait", empty, 212 },
- { "If I needed someone", empty, 213 },
- { "Run for your life", empty, 214 },
- { FRAME_END },
-
- { "Revolver", FNULL, 3 },
- { "Taxman", empty, 301 },
- { "Eleanor rigby", empty, 302 },
- { "I'm only sleeping", empty, 303 },
- { "Love you to", empty, 304 },
- { "Here, there and everywhere", empty, 305 },
- { "Yellow submarine", empty, 306 },
- { "She said she said", empty, 307 },
- { "Good day sunshine", empty, 308 },
- { "And your bird can sing", empty, 309 },
- { "For no one", empty, 310 },
- { "Doctor robert", empty, 311 },
- { "I want to tell you", empty, 312 },
- { "Got to get you into my life", empty, 313 },
- { "Tomorrow never knows", empty, 314 },
- { FRAME_END },
-
- { "Sgt. Pepper's Lonely Hearts Club Band", FNULL, 4 },
- { "Sgt. pepper's lonely hearts club band", empty, 401 },
- { "With a little help from my friends", empty, 402 },
- { "Lucy in the sky with diamonds", empty, 403 },
- { "Getting better", empty, 404 },
- { "Fixing a hole", empty, 405 },
- { "She's leaving home", empty, 406 },
- { "Being for the benefit of mr. kite", empty, 407 },
- { "Within you without you", empty, 408 },
- { "When I'm sixty-four", empty, 409 },
- { "Lovely rita", empty, 410 },
- { "Good morning good morning", empty, 411 },
- { "Sgt. pepper's lonely hearts club band (reprise)", empty, 412 },
- { "A day in the life", empty, 413 },
- { FRAME_END },
- { FRAME_END }
- };
-
- /*
- FRAMER HELP
-
- The framer menu system pre-empts the standard help system so that
- help works a bit differently. Normally, FN1 is caught by special_key
- and help_Show is called. The framer_fkey, however, hands the FN1 key
- to framer_help before it gets to special_key.
-
- help for item in has Chapter no., Paragraph no.
- ----------------------------------------------------------------
- top menu bar idata of ITS 0 (ZERO always)
- frame_def entry
-
- pulldown menu idata of its PARENT field number + 1
- entry
-
-
- Here is how framer_help works with the demofram.c menu structure:
-
- The "Help!" disc, above, is associated with the help message for
- chapter 1
- (its 'idata' value ) and,
- paragraph 0
-
- The 14 songs on the "Help!" disc are associated with the message(s) for
- chapter 1
- (the 'idata' of its parent -- i.e., the "Help!" disc) and,
- paragraphs 1 through 14
- (the (field number + 1) of the pulldown menu song choice)
-
-
- The "Sgt. Pepper's" disc is associated with the help message for
- chapter 4
- (its 'idata' value) and,
- paragraph 0
-
- The 13 songs on the "Sgt. Pepper's" disc are associated with the message(s) for
- chapter 4
- ( the 'idata' of its parent) and,
- paragraphs 1 through 13
- */
-
- /*
- for help_View help system display use a sed
- default row & col position, 6 rows high, 40 columns wide,
- in normal video, with the bd_prompt border
- */
- struct hv_struct hvd = { -1, -1, 6, 50, 0x07, bd_prompt };
-
- int main(void)
- {
- sed_type frame;
- FILE *fp = NULL;
-
- /* Initialize the display */
- disp_Init(def_ModeText, FNULL);
-
- /* Turn on the mouse */
- hard_InitMouse();
-
- /* Turn on sedwin mouse */
- sedwin_ClassInit();
-
- /* open the help file */
- fp = fopen("demofram.hlp", "rb");
-
- if (fp == NULL) {
- pop_Prompt("Unable to open help file.\n", -1, -1, -1, 26, 0x70, bd_2);
- }
-
- /*
- help_Init sets up the help system.
- The first argument is a pointer to the help file.
- The second argument is a pointer to the help display function.
- The third argument tells the help system how much space to allocate
- to hold the help messages. This is the maximum size of a help message.
-
- The cscape field functions automatically call help when F1 is pressed.
- (see fnspec.c)
- */
- else {
- help_Init(fp, help_View, 100, (VOID *) &hvd);
- }
-
- frame = frame_Open(test_frame, bd_1, 0x70, 0x07, 0x70);
- frame_Repaint(frame);
-
- frame_Go(frame, (char) ' ', NULL);
- frame_Close(frame);
-
- /* Close down the display interface */
- disp_Close();
-
- if (fp != NULL) {
- /* close help file */
- fclose(fp);
- }
- exit(0);
- return(0);
- }
-
- int empty(VOID *sdata, int idata)
- /*
- A user supplied function...
- */
- {
- char msg[80];
-
- oak_notused(sdata);
-
- sprintf(msg, "This is song has id %3.d\n", idata);
-
- pop_Prompt(msg, -1, -1, -1, -1, 0x70, bd_2);
-
- /* return 0 to return to stay in the menuing system */
- /* return positive value to exit menuing system */
-
- return(0);
- }
-
-
-
-