/* * GRAPH, Version 1.00 - 4 August 1989 * * Copyright 1989, David Gay. All Rights Reserved. * This software is freely redistrubatable. */ /* User interface routines (windows, menus, requesters, etc) */ #ifndef UIO_H #define UIO_H #include "list.h" #define FONTLEN 30 /* font name length */ #define NBLEN 25 #define INTLEN 11 /* A gadget handler routine, called for every gadget event when a requester is present */ typedef int gadgevent(struct Gadget *gadg, ULONG class, struct Requester *req, struct graph *g); /* All possible commands */ enum commands {none, reqgone, /* internal */ close, /* window closed */ /* menu functions */ _new_graph, _load_graph, _save_graph, print_graph, iff_graph, lo ad_vars, save_vars, quit, limits, axes, zoom, zoom_out, center, add_function, add_label, edit, improve, del_object, edit_vars }; /* Description of selected command, union depends on command */ struct cmd { enum commands command; struct graph *g; union { struct function *f; struct object *o; double zoom_out; struct { double x0, y0, x1, y1; } zoom_in; struct { double x, y; } pt; } data; }; extern tlist flist; /* List of available font names */ int make_font_list(void); /* (Re)make flist */ char *addfont(char *fname); /* Add/Remove ".font" from font names */ char *remfont(char *fname); /* Display requester(in graph g), wait for it to leave */ /* handle will be called for every gadget event */ int DoRequest(struct Requester *r, struct graph *g, gadgevent *handle); /* The default gadget handler (switches between text gadgets) */ int std_ghandler(struct Gadget *gg, ULONG class, struct Requester *req, struct graph *g); int getfile(char *file, char *msg); /* File requester */ struct Requester *abort_request(struct graph *g, char *msg); /* Setup an abort requester */ void set_abort_msg(struct Requester *req, char *msg); /* Change abort ms g */ void end_abort_request(struct Requester *req); /* Clear abort req */ int aborted(struct Requester *req); /* Did user abort ? */ void message(struct graph *g, ...); /* Display a messa ge (in a graph) */ void alert(struct Window *win, char *msg1, char *msg2); /* Use when no gra ph available */ void nomem(struct Window *win); /* Standard no mem ory alert */ struct cmd next_command(void); /* Return next selected command */ /* String utility functions, convert numbers to strings */ char *double2str(char *to, double x); double str2double(char *from); char *int2str(char *to, int x); int str2int(char *from); char *strip(char *name); /* Strip leading & trailing blanks */ /* Enable/Disable various menus */ void disable_rect_menus(struct graph *g); /* Menus for 'pos' object */ void enable_rect_menus(struct graph *g); void disable_object_menus(struct graph *g); /* For selected objects */ void enable_object_menus(struct graph *g); int init_user(void); void cleanup_user(void); int init_uio(struct graph *g); /* Setup/Cleanup interface for each graph * / void cleanup_uio(struct graph *g); #endif