1 /* Copyright (C) 1992-1998 The Geometry Center 2 * Copyright (C) 1998-2000 Stuart Levy, Tamara Munzner, Mark Phillips 3 * 4 * This file is part of Geomview. 5 * 6 * Geomview is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU Lesser General Public License as published 8 * by the Free Software Foundation; either version 2, or (at your option) 9 * any later version. 10 * 11 * Geomview is distributed in the hope that it will be useful, but 12 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with Geomview; see the file COPYING. If not, write 18 * to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, 19 * USA, or visit http://www.gnu.org. 20 */ 21 22 23 /* Authors: Stuart Levy, Tamara Munzner, Mark Phillips, 24 Celeste Fowler */ 25 26 #ifndef UI_H 27 #define UI_H 28 29 #include "common.h" 30 31 #define MAXMODES 16 /* Max built-in motion modes */ 32 #define MAXMORE 10 33 #define MAXTOOLS 10 /* Max built-in tools */ 34 #define MAXACTIONS 10 /* Max built-in actions */ 35 36 typedef struct _emodule { 37 char *name; 38 void (*func)(); 39 char *text; 40 int pid; 41 Pool *link; 42 void *data; 43 char *dir; 44 } emodule; 45 46 typedef struct { 47 int targetgeom; /* index of target Geom for user actions */ 48 int targetcam; /* index of target Camera for user actions */ 49 int targettype; /* T_GEOM, T_CAM, or T_NONE */ 50 int targetid; /* id of target (geom or cam) (moving obj) */ 51 int centerid; /* id of center of motion) */ 52 int bbox_center; /* use center of bbox of centerid as origin */ 53 int mousefocus; /* index of camera (window) where mouse is */ 54 int cam_wm_focus; /* true: activate cam-win on 55 * FocusChange events, false: activate 56 * cam-win on mouse-cross events. 57 */ 58 59 int savewhat; /* What in the world did we want to save? 60 (NOID = all) */ 61 /* 62 * Motion modes are no longer separated into two arrays of geoms and cams. 63 * Everything is in one array. 64 */ 65 PFI modes[MAXMODES]; /* motion procs */ 66 char *modenames[MAXMODES]; /* motion names */ 67 int modetype[MAXMODES]; /* type of motion: 68 T_NONE if could be either, 69 T_CAM or T_GEOM if specific*/ 70 int mode_count; /* number of entries in above arrays */ 71 int mode_current; /* current mode */ 72 73 vvec emod; /* External module table */ 74 int emod_changed; /* Set if browser changed since drawn */ 75 int emod_check; /* Set if some emodule died */ 76 char *emod_dir; /* if non-NULL, pathname of emodule's dir */ 77 int lights_shown; /* are lights drawn? */ 78 int current_light; /* currently selected light for editing */ 79 80 int cursor_on; /* cursor visible? */ 81 int clamp_cursor; /* cursor clamped to center of window */ 82 int cursor_still; /* microseconds in which cursor must 83 not move to as holding 84 still */ 85 int cursor_twitch; /* distance cursor must not move 86 (in either x or y) to register 87 as holding still. */ 88 float longwhile; /* Max credible real time (in seconds) 89 * between redraws. If dt > longwhile, 90 * clamp it to longwhile to avoid huge 91 * jumps in motion. */ 92 93 Color pickedbboxcolor; /* Color of picked objects' bboxes */ 94 int backface; /* Cull back-facing polygons */ 95 int apoverride; /* -1 if appearance controls should 96 * override, else 0 */ 97 int ownmotion; /* Interactive motions with respect to 98 * object's own coordinates, not camera. 99 */ 100 int constrained; /* Constrain interactive motions to 101 * just one (X/Y) axis, whichever is 102 * greater. 103 */ 104 int inertia; /* Motions have inertia */ 105 int freeze; /* Whether to freeze UI panels */ 106 int pick_invisible; /* Should picks be sensitive to invisible objects? */ 107 } UIState; 108 109 extern UIState uistate; 110 111 /* shading */ 112 #define CONSTANTSHADE APF_CONSTANT 113 #define FLATSHADE APF_FLAT 114 #define SMOOTHSHADE APF_SMOOTH 115 extern char *shades[5]; 116 117 /* translucency */ 118 #define BSPTREE_BLENDING APF_ALPHA_BLENDING 119 #define SCREEN_DOOR APF_SCREEN_DOOR 120 #define SIMPLE_BLENDING APF_NAIVE_BLENDING 121 extern char *translucencies[3]; 122 123 /* normalization --- these must be consective beginning with 0 --- 124 they are used as indices into the "norm" array !!! */ 125 typedef enum { NONE = 0, EACH, ALL, KEEP } Normalization; 126 extern char *norm[4]; 127 128 /* projection */ 129 typedef enum { ORTHOGRAPHIC = 0, PERSPECTIVE } Projection; 130 extern char *proj[2]; 131 132 /* UI space */ 133 /* NOTE: These are now strictly UI values. Internally space is recorded 134 using TM_EUCLIDEAN, etc from transform3.h. */ 135 #define EUCLIDEAN 0 136 #define HYPERBOLIC 1 137 #define SPHERICAL 2 138 extern char *spc[3]; 139 extern char *mdl[3]; 140 141 /* motion mode names */ 142 extern char OBJROTATE[]; /* Rotate */ 143 extern char OBJTRANSLATE[]; /* Translate */ 144 extern char OBJSCALE[]; /* Scale */ 145 extern char OBJZOOM[]; /* Zoom -- FOV! */ 146 147 extern char OBJFLY[]; /* Cam Fly */ 148 extern char OBJORBIT[]; /* Cam Orbit */ 149 150 extern char LIGHTEDIT[]; /* Edit Lights */ 151 152 #define IMMEDIATE 1 153 #define NOIMMEDIATE 0 154 155 /* Tools */ 156 157 /* These MUST match the order declared in cui_init!! */ 158 #define TOOL_ROT 0 159 #define TOOL_ZOOM 1 160 #define TOOL_TRANS 2 161 #define TOOL_FLY 3 162 #define TOOL_ORBIT 4 163 #define TOOL_SCALE 5 164 165 /* Actions */ 166 #define ACTION_STOP 0 167 #define ACTION_PAUSE 1 168 #define ACTION_CENTER 2 169 #define ACTION_RESET 3 170 #define ACTION_LOOK 4 171 172 #define UI_ADD 0 173 #define UI_REPLACE 1 174 #define UI_ADDCAMERA 2 175 176 #define UI_TARGET 0 177 #define UI_CENTER 1 178 179 /* Cursor */ 180 #define UI_CURSOR_STILL 100 181 #define UI_CURSOR_TWITCH 5 182 183 184 /* in ui.c */ 185 186 extern void ui_install_mode(char *name, PFI proc, int type); 187 extern void ui_reinstall_mode(char *name, PFI proc, int type, int index); 188 extern void ui_uninstall_mode(char *name); 189 extern int ui_mode_index(char *name); 190 extern emodule *ui_emodule_install(int after, char *external, PFI func); 191 extern int ui_emodule_index(char *external, emodule **emp); 192 extern void ui_emodule_uninstall(int index); 193 extern void set_ui_target(int type, int index); 194 extern void set_ui_center(int id); 195 extern void set_ui_target_id(int id); 196 extern void set_ui_center_origin(int use_bbox_center); 197 extern void set_ui_wm_focus(int cam_wm_focus); 198 extern void ui_cleanup(); 199 200 /* in glui.c */ 201 202 extern int ui_panelshown(int index); 203 extern void ui_showpanel( int index, int show ); 204 extern void ui_init(); 205 extern void env_init(); 206 extern void ui_lights_changed(); 207 extern void set_light_display(int lightno); 208 extern void ui_keyboard(int ch); 209 extern void timing(int interval); 210 extern void ui_add_mode(char *name, PFI proc, int type); 211 extern void ui_remove_mode(char *name); 212 extern void ui_replace_mode(char *name, PFI proc, int type, int index); 213 extern void ui_event_mode(char *mode); 214 extern void ui_action(int val); 215 extern void ui_popup_message(char *s); 216 217 218 extern void ui_mousefocus(int index); 219 extern void ui_objectchange(); 220 extern void ui_maybe_refresh(int id); 221 extern void set_light_intensity(float intens); 222 extern void lights_changed_check(); 223 extern void ui_light_button(); 224 extern void ui_changed_lights(); 225 226 /* ui_fileio() pops up a file browser/input panel. 227 * It loads the resulting file if dosave==0, 228 * saves state into it otherwise. 229 */ 230 extern void ui_fileio( int dosave ); 231 232 /* ui_pickcolor() pops up a color picker, 233 * sets the color associated with the given code, 234 * e.g. DRAWER_EDGECOLOR or DRAWER_BACKCOLOR. 235 */ 236 extern void ui_pickcolor( int drawer_code ); 237 238 /* ui_curson() toggles cursor visibility. 239 * 1 : enable, 0 : disable, -1 : toggle. 240 */ 241 extern void ui_curson( int toggle ); 242 243 /* ui_name2panel() looks up the name of a UI panel 244 * and returns a UI-specific index if found, 245 * otherwise zero. 246 */ 247 extern int ui_name2panel( char *name ); 248 249 /* ui_showpanel() makes the given UI panel visible 250 * or invisible, according to 'show' 251 */ 252 extern void ui_showpanel( int index, int show ); 253 254 /* ui_manual_browser() tries to spawn an external 255 * html or pdf browser to give access to the manual. 256 * "type" may be either "html" or "pdf", other values 257 * are silently ignored. 258 */ 259 extern void ui_manual_browser(const char *type); 260 261 /* ui_panelwindow() specifies positioning for the 262 * given UI panel from the given WnWindow. 263 */ 264 extern void ui_panelwindow( int index, WindowStruct *ws ); 265 extern void cui_init(); 266 267 extern int uispace(int space); 268 extern void ui_windowWillOpen(DView *dv); 269 extern void ui_windowDidOpen(DView *dv); 270 #endif /* ! UI_H */ 271 272 /* 273 * Local Variables: *** 274 * c-basic-offset: 2 *** 275 * End: *** 276 */ 277