home *** CD-ROM | disk | FTP | other *** search
- /****************************** MENU FUNCTIONS ******************************/
-
- /*--- Set the state of the menu. ---*/
- /*--- Called when the menu is displayed. ---*/
- static menu hp11_menumaker(void *handle)
- {
- hp11_data *d = (hp11_data *)handle;
-
- /* Shade the save entry if there is no file loaded */
- menu_setflags(d->menu, hp11_menu_save, 0, !d->loaded);
-
- return d->menu;
- }
-
- /****************************** EVENT HANDLERS ******************************/
- /*--- Event handler for the menu. 'handle' is a pointer to the diagram. ---*/
- static void hp11_menuproc(void *handle, char *hit)
- {
- hp11_data *d = (hp11_data *)handle;
-
- /* Find which menu item was hit and take action as appropriate */
- switch (hit[0])
- {
-
- case hp11_menu_save:
- /* Initiate save operation */
- hp11_save_window = d->whandle;
- saveas(hp11_drawtype, d->file, d->diagram.length, hp11_saver,
- hp11_sender, 0 /* No printer procedure */, d);
- hp11_save_window = -1;
- break;
-
- }
- }
-
- /*--- Event handler for window. 'handle' is a pointer to the diagram. ---*/
- static void hp11_event_handler(wimp_eventstr *e, void *handle)
- {
- hp11_data *d = (hp11_data *)handle;
-
- /* Deal with event */
- switch (e->e)
- {
- case wimp_EREDRAW:
- hp11_redraw_window(e->data.o.w, d);
- break;
-
- case wimp_ESEND:
- case wimp_ESENDWANTACK:
- {
- /* We deal only with messages for loading and saving files here, using
- essentially the skeleton code given in the manual
- */
- switch (e->data.msg.hdr.action)
- {
- case wimp_MDATASAVE: /* import data */
- hp11_load_ram(d);
- break;
-
- case wimp_MDATALOAD: /* insert data */
- case wimp_MDATAOPEN:
- hp11_load_file(d);
- break;
-
- default: break; /* ignore other messages */
- }
- }
-
- default: /* Ignore any other event */
- break;
- }
- }
-
-