diff options
| author | Dave Love | 1999-10-03 19:36:13 +0000 |
|---|---|---|
| committer | Dave Love | 1999-10-03 19:36:13 +0000 |
| commit | e745ede7473e87b93d71858bc1c8447a1307de28 (patch) | |
| tree | 59353dca94fcb3a9ce2fd9f79614a3119da7f863 /oldXMenu | |
| parent | 0c898dd963a3277b5ec8d59f0a350e3fb50e50c3 (diff) | |
| download | emacs-e745ede7473e87b93d71858bc1c8447a1307de28.tar.gz emacs-e745ede7473e87b93d71858bc1c8447a1307de28.zip | |
#
Diffstat (limited to 'oldXMenu')
39 files changed, 5368 insertions, 0 deletions
diff --git a/oldXMenu/Activate.c b/oldXMenu/Activate.c new file mode 100644 index 00000000000..fb1ef2bb291 --- /dev/null +++ b/oldXMenu/Activate.c | |||
| @@ -0,0 +1,546 @@ | |||
| 1 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/Activate.c,v 1.1 1992/04/11 22:10:17 jimb Exp $ */ | ||
| 2 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 3 | |||
| 4 | #include "copyright.h" | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuActivate - Maps a given menu to the display and activates | ||
| 10 | * the menu for user selection. The user is allowed to | ||
| 11 | * specify which pane and selection will be current, | ||
| 12 | * the X and Y location of the menu (relative to the | ||
| 13 | * parent window) and the mouse button event mask that | ||
| 14 | * will be used to identify a selection request. | ||
| 15 | * | ||
| 16 | * A menu selection is shown to be current by placing | ||
| 17 | * a highlight box around the selection as the mouse | ||
| 18 | * cursor enters its active region. Inactive selections | ||
| 19 | * will not be highlighted. As the mouse cursor moved | ||
| 20 | * from one menu pane to another menu pane the pane being | ||
| 21 | * entered is raised and made current and the pane being | ||
| 22 | * left is lowered. | ||
| 23 | * | ||
| 24 | * Anytime XMenuActivate returns, the p_num and | ||
| 25 | * s_num are left at their last known values (i.e., | ||
| 26 | * the last known current pane and selection indices). | ||
| 27 | * The following are the defined return states: | ||
| 28 | * | ||
| 29 | * 1) If at any time an error occurs the data | ||
| 30 | * pointer is left untouched and XM_FAILURE | ||
| 31 | * is returned. | ||
| 32 | * | ||
| 33 | * 2) When a selection request is received (i.e., | ||
| 34 | * when the specified mouse event occurs) the | ||
| 35 | * data pointer will be set to the data | ||
| 36 | * associated with the particular selection | ||
| 37 | * current at the time of the selection request | ||
| 38 | * and XM_SUCCESS is returned. | ||
| 39 | * | ||
| 40 | * 3) If no selection was current at the time a | ||
| 41 | * selection request is made the data pointer | ||
| 42 | * will be left untouched and XM_NO_SELECT will | ||
| 43 | * be returned. | ||
| 44 | * | ||
| 45 | * 4) If the selection that was current at the time | ||
| 46 | * a selection request is made is not an active | ||
| 47 | * selection the data pointer will be left | ||
| 48 | * untouched and XM_IA_SELECT will be returned. | ||
| 49 | * | ||
| 50 | * Since X processes events in an asynchronous manner | ||
| 51 | * it is likely that XMenuActivate will encounter | ||
| 52 | * a "foreign event" while it is executing. Foreign | ||
| 53 | * events are handled in one of three ways: | ||
| 54 | * | ||
| 55 | * 1) The event is discarded. This is the default | ||
| 56 | * mode and requires no action on the part of the | ||
| 57 | * application. | ||
| 58 | * | ||
| 59 | * 2) The application has identified an asynchronous | ||
| 60 | * event handler that will be called and the | ||
| 61 | * foreign event handed off to it. Note: | ||
| 62 | * AEQ mode disables this mode temporarily. | ||
| 63 | * | ||
| 64 | * 3) The application has enabled asynchronous event | ||
| 65 | * queuing mode. In this mode all foreign events | ||
| 66 | * will be queued up untill XMenuActivate | ||
| 67 | * terminates; at which time they will be | ||
| 68 | * returned to the X event queue. As long as | ||
| 69 | * AEQ mode is enabled any asynchronous event | ||
| 70 | * handler as temporarily disabled. | ||
| 71 | * | ||
| 72 | * Any events encountered while taking down the menu | ||
| 73 | * (i.e., exposure events from occluded windows) will | ||
| 74 | * automatically be returned to the X event queue after | ||
| 75 | * XMenuActivate has cleaned the queue of any of its own | ||
| 76 | * events that are no longer needed. | ||
| 77 | * | ||
| 78 | * Author: Tony Della Fera, DEC | ||
| 79 | * March 12, 1986 | ||
| 80 | * | ||
| 81 | */ | ||
| 82 | |||
| 83 | #include <config.h> | ||
| 84 | #include "XMenuInt.h" | ||
| 85 | |||
| 86 | int | ||
| 87 | XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data) | ||
| 88 | register Display *display; /* Display to put menu on. */ | ||
| 89 | register XMenu *menu; /* Menu to activate. */ | ||
| 90 | int *p_num; /* Pane number selected. */ | ||
| 91 | int *s_num; /* Selection number selected. */ | ||
| 92 | int x_pos; /* X coordinate of menu position. */ | ||
| 93 | int y_pos; /* Y coordinate of menu position. */ | ||
| 94 | unsigned int event_mask; /* Mouse button event mask. */ | ||
| 95 | char **data; /* Pointer to return data value. */ | ||
| 96 | { | ||
| 97 | int status; /* X routine call status. */ | ||
| 98 | int orig_x; /* Upper left menu origin X coord. */ | ||
| 99 | int orig_y; /* Upper left menu origin Y coord. */ | ||
| 100 | int ret_val; /* Return value. */ | ||
| 101 | |||
| 102 | register XMPane *p_ptr; /* Current XMPane. */ | ||
| 103 | register XMPane *event_xmp; /* Event XMPane pointer. */ | ||
| 104 | register XMPane *cur_p; /* Current pane. */ | ||
| 105 | register XMSelect *cur_s; /* Current selection. */ | ||
| 106 | XMWindow *event_xmw; /* Event XMWindow pointer. */ | ||
| 107 | XEvent event; /* X input event. */ | ||
| 108 | XEvent peek_event; /* X input peek ahead event. */ | ||
| 109 | |||
| 110 | Bool selection = False; /* Selection has been made. */ | ||
| 111 | Bool forward = True; /* Moving forward in the pane list. */ | ||
| 112 | |||
| 113 | Window root, child; | ||
| 114 | int root_x, root_y, win_x, win_y; | ||
| 115 | unsigned int mask; | ||
| 116 | |||
| 117 | /* | ||
| 118 | * Define and allocate a foreign event queue to hold events | ||
| 119 | * that don't belong to XMenu. These events are later restored | ||
| 120 | * to the X event queue. | ||
| 121 | */ | ||
| 122 | typedef struct _xmeventque { | ||
| 123 | XEvent event; | ||
| 124 | struct _xmeventque *next; | ||
| 125 | } XMEventQue; | ||
| 126 | |||
| 127 | XMEventQue *feq = NULL; /* Foreign event queue. */ | ||
| 128 | XMEventQue *feq_tmp; /* Foreign event queue temporary. */ | ||
| 129 | |||
| 130 | /* | ||
| 131 | * If there are no panes in the menu then return failure | ||
| 132 | * because the menu is not initialized. | ||
| 133 | */ | ||
| 134 | if (menu->p_count == 0) { | ||
| 135 | _XMErrorCode = XME_NOT_INIT; | ||
| 136 | return(XM_FAILURE); | ||
| 137 | } | ||
| 138 | |||
| 139 | /* | ||
| 140 | * Find the desired current pane. | ||
| 141 | */ | ||
| 142 | cur_p = _XMGetPanePtr(menu, *p_num); | ||
| 143 | if (cur_p == NULL) { | ||
| 144 | return(XM_FAILURE); | ||
| 145 | } | ||
| 146 | cur_p->activated = cur_p->active; | ||
| 147 | |||
| 148 | /* | ||
| 149 | * Find the desired current selection. | ||
| 150 | * If the current selection index is out of range a null current selection | ||
| 151 | * will be assumed and the cursor will be placed in the current pane | ||
| 152 | * header. | ||
| 153 | */ | ||
| 154 | cur_s = _XMGetSelectionPtr(cur_p, *s_num); | ||
| 155 | |||
| 156 | /* | ||
| 157 | * Compute origin of menu so that cursor is in | ||
| 158 | * Correct pane and selection. | ||
| 159 | */ | ||
| 160 | _XMTransToOrigin(display, | ||
| 161 | menu, | ||
| 162 | cur_p, cur_s, | ||
| 163 | x_pos, y_pos, | ||
| 164 | &orig_x, &orig_y); | ||
| 165 | menu->x_pos = orig_x; /* Store X and Y coords of menu. */ | ||
| 166 | menu->y_pos = orig_y; | ||
| 167 | |||
| 168 | if (XMenuRecompute(display, menu) == XM_FAILURE) { | ||
| 169 | return(XM_FAILURE); | ||
| 170 | } | ||
| 171 | |||
| 172 | /* | ||
| 173 | * Flush the window creation queue. | ||
| 174 | * This batches all window creates since lazy evaluation | ||
| 175 | * is more efficient than individual evaluation. | ||
| 176 | * This routine also does an XFlush(). | ||
| 177 | */ | ||
| 178 | if (_XMWinQueFlush(display, menu, cur_p, cur_s) == _FAILURE) { | ||
| 179 | return(XM_FAILURE); | ||
| 180 | } | ||
| 181 | |||
| 182 | /* | ||
| 183 | * Make sure windows are in correct order (in case we were passed | ||
| 184 | * an already created menu in incorrect order.) | ||
| 185 | */ | ||
| 186 | for(p_ptr = menu->p_list->next; p_ptr != cur_p; p_ptr = p_ptr->next) | ||
| 187 | XRaiseWindow(display, p_ptr->window); | ||
| 188 | for(p_ptr = menu->p_list->prev; p_ptr != cur_p->prev; p_ptr = p_ptr->prev) | ||
| 189 | XRaiseWindow(display, p_ptr->window); | ||
| 190 | |||
| 191 | /* | ||
| 192 | * Make sure all selection windows are mapped. | ||
| 193 | */ | ||
| 194 | for ( | ||
| 195 | p_ptr = menu->p_list->next; | ||
| 196 | p_ptr != menu->p_list; | ||
| 197 | p_ptr = p_ptr->next | ||
| 198 | ){ | ||
| 199 | XMapSubwindows(display, p_ptr->window); | ||
| 200 | } | ||
| 201 | |||
| 202 | /* | ||
| 203 | * Synchronize the X buffers and the event queue. | ||
| 204 | * From here on, all events in the queue that don't belong to | ||
| 205 | * XMenu are sent back to the application via an application | ||
| 206 | * provided event handler or discarded if the application has | ||
| 207 | * not provided an event handler. | ||
| 208 | */ | ||
| 209 | XSync(display, 0); | ||
| 210 | |||
| 211 | /* | ||
| 212 | * Grab the mouse for menu input. | ||
| 213 | */ | ||
| 214 | |||
| 215 | status = XGrabPointer( | ||
| 216 | display, | ||
| 217 | menu->parent, | ||
| 218 | True, | ||
| 219 | event_mask, | ||
| 220 | GrabModeAsync, | ||
| 221 | GrabModeAsync, | ||
| 222 | None, | ||
| 223 | menu->mouse_cursor, | ||
| 224 | CurrentTime | ||
| 225 | ); | ||
| 226 | if (status == _X_FAILURE) { | ||
| 227 | _XMErrorCode = XME_GRAB_MOUSE; | ||
| 228 | return(XM_FAILURE); | ||
| 229 | } | ||
| 230 | |||
| 231 | /* | ||
| 232 | * Map the menu panes. | ||
| 233 | */ | ||
| 234 | XMapWindow(display, cur_p->window); | ||
| 235 | for (p_ptr = menu->p_list->next; | ||
| 236 | p_ptr != cur_p; | ||
| 237 | p_ptr = p_ptr->next) | ||
| 238 | XMapWindow(display, p_ptr->window); | ||
| 239 | for (p_ptr = cur_p->next; | ||
| 240 | p_ptr != menu->p_list; | ||
| 241 | p_ptr = p_ptr->next) | ||
| 242 | XMapWindow(display, p_ptr->window); | ||
| 243 | |||
| 244 | XRaiseWindow(display, cur_p->window); /* Make sure current */ | ||
| 245 | /* pane is on top. */ | ||
| 246 | |||
| 247 | cur_s = NULL; /* Clear current selection. */ | ||
| 248 | |||
| 249 | /* | ||
| 250 | * Begin event processing loop. | ||
| 251 | */ | ||
| 252 | while (1) { | ||
| 253 | XNextEvent(display, &event); /* Get next event. */ | ||
| 254 | switch (event.type) { /* Dispatch on the event type. */ | ||
| 255 | case Expose: | ||
| 256 | event_xmp = (XMPane *)XLookUpAssoc(display, | ||
| 257 | menu->assoc_tab, | ||
| 258 | event.xexpose.window); | ||
| 259 | if (event_xmp == NULL) { | ||
| 260 | /* | ||
| 261 | * If AEQ mode is enabled then queue the event. | ||
| 262 | */ | ||
| 263 | if (menu->aeq) { | ||
| 264 | feq_tmp = (XMEventQue *)malloc(sizeof(XMEventQue)); | ||
| 265 | if (feq_tmp == NULL) { | ||
| 266 | _XMErrorCode = XME_CALLOC; | ||
| 267 | return(XM_FAILURE); | ||
| 268 | } | ||
| 269 | feq_tmp->event = event; | ||
| 270 | feq_tmp->next = feq; | ||
| 271 | feq = feq_tmp; | ||
| 272 | } | ||
| 273 | else if (_XMEventHandler) (*_XMEventHandler)(&event); | ||
| 274 | break; | ||
| 275 | } | ||
| 276 | if (event_xmp->activated) { | ||
| 277 | XSetWindowBackground(display, | ||
| 278 | event_xmp->window, | ||
| 279 | menu->bkgnd_color); | ||
| 280 | } | ||
| 281 | else { | ||
| 282 | XSetWindowBackgroundPixmap(display, | ||
| 283 | event_xmp->window, | ||
| 284 | menu->inact_pixmap); | ||
| 285 | } | ||
| 286 | _XMRefreshPane(display, menu, event_xmp); | ||
| 287 | break; | ||
| 288 | case EnterNotify: | ||
| 289 | /* | ||
| 290 | * First wait a small period of time, and see | ||
| 291 | * if another EnterNotify event follows hard on the | ||
| 292 | * heels of this one. i.e., the user is simply | ||
| 293 | * "passing through". If so, ignore this one. | ||
| 294 | */ | ||
| 295 | |||
| 296 | event_xmw = (XMWindow *)XLookUpAssoc(display, | ||
| 297 | menu->assoc_tab, | ||
| 298 | event.xcrossing.window); | ||
| 299 | if (event_xmw == NULL) break; | ||
| 300 | if (event_xmw->type == SELECTION) { | ||
| 301 | /* | ||
| 302 | * We have entered a selection. | ||
| 303 | */ | ||
| 304 | /* if (XPending(display) == 0) usleep(150000); */ | ||
| 305 | if (XPending(display) != 0) { | ||
| 306 | XPeekEvent(display, &peek_event); | ||
| 307 | if(peek_event.type == LeaveNotify) { | ||
| 308 | break; | ||
| 309 | } | ||
| 310 | } | ||
| 311 | cur_s = (XMSelect *)event_xmw; | ||
| 312 | /* | ||
| 313 | * If the pane we are in is active and the | ||
| 314 | * selection entered is active then activate | ||
| 315 | * the selection. | ||
| 316 | */ | ||
| 317 | if (cur_p->active && cur_s->active > 0) { | ||
| 318 | cur_s->activated = 1; | ||
| 319 | _XMRefreshSelection(display, menu, cur_s); | ||
| 320 | } | ||
| 321 | } | ||
| 322 | else { | ||
| 323 | /* | ||
| 324 | * We have entered a pane. | ||
| 325 | */ | ||
| 326 | /* if (XPending(display) == 0) usleep(150000); */ | ||
| 327 | if (XPending(display) != 0) { | ||
| 328 | XPeekEvent(display, &peek_event); | ||
| 329 | if (peek_event.type == EnterNotify) break; | ||
| 330 | } | ||
| 331 | XQueryPointer(display, | ||
| 332 | menu->parent, | ||
| 333 | &root, &child, | ||
| 334 | &root_x, &root_y, | ||
| 335 | &win_x, &win_y, | ||
| 336 | &mask); | ||
| 337 | event_xmp = (XMPane *)XLookUpAssoc(display, | ||
| 338 | menu->assoc_tab, | ||
| 339 | child); | ||
| 340 | if (event_xmp == NULL) break; | ||
| 341 | if (event_xmp == cur_p) break; | ||
| 342 | if (event_xmp->serial > cur_p->serial) forward = True; | ||
| 343 | else forward = False; | ||
| 344 | p_ptr = cur_p; | ||
| 345 | while (p_ptr != event_xmp) { | ||
| 346 | if (forward) p_ptr = p_ptr->next; | ||
| 347 | else p_ptr = p_ptr->prev; | ||
| 348 | XRaiseWindow(display, p_ptr->window); | ||
| 349 | } | ||
| 350 | if (cur_p->activated) { | ||
| 351 | cur_p->activated = False; | ||
| 352 | XSetWindowBackgroundPixmap(display, | ||
| 353 | cur_p->window, | ||
| 354 | menu->inact_pixmap); | ||
| 355 | _XMRefreshPane(display, menu, cur_p); | ||
| 356 | } | ||
| 357 | if (event_xmp->active) event_xmp->activated = True; | ||
| 358 | #if 1 | ||
| 359 | /* | ||
| 360 | * i suspect the we don't get an EXPOSE event when backing | ||
| 361 | * store is enabled; the menu windows content is probably | ||
| 362 | * not drawn in when it should be in that case. | ||
| 363 | * in that case, this is probably an ugly fix! | ||
| 364 | * i hope someone more familiar with this code would | ||
| 365 | * take it from here. -- caveh@eng.sun.com. | ||
| 366 | */ | ||
| 367 | XSetWindowBackground(display, | ||
| 368 | event_xmp->window, | ||
| 369 | menu->bkgnd_color); | ||
| 370 | _XMRefreshPane(display, menu, event_xmp); | ||
| 371 | #endif | ||
| 372 | cur_p = event_xmp; | ||
| 373 | } | ||
| 374 | break; | ||
| 375 | case LeaveNotify: | ||
| 376 | event_xmw = (XMWindow *)XLookUpAssoc( | ||
| 377 | display, | ||
| 378 | menu->assoc_tab, | ||
| 379 | event.xcrossing.window | ||
| 380 | ); | ||
| 381 | if (event_xmw == NULL) break; | ||
| 382 | if(cur_s == NULL) break; | ||
| 383 | |||
| 384 | /* | ||
| 385 | * If the current selection was activated then | ||
| 386 | * deactivate it. | ||
| 387 | */ | ||
| 388 | if (cur_s->activated) { | ||
| 389 | cur_s->activated = False; | ||
| 390 | _XMRefreshSelection(display, menu, cur_s); | ||
| 391 | } | ||
| 392 | cur_s = NULL; | ||
| 393 | break; | ||
| 394 | |||
| 395 | case ButtonPress: | ||
| 396 | case ButtonRelease: | ||
| 397 | *p_num = cur_p->serial; | ||
| 398 | /* | ||
| 399 | * Check to see if there is a current selection. | ||
| 400 | */ | ||
| 401 | if (cur_s != NULL) { | ||
| 402 | /* | ||
| 403 | * Set the selection number to the current selection. | ||
| 404 | */ | ||
| 405 | *s_num = cur_s->serial; | ||
| 406 | /* | ||
| 407 | * If the current selection was activated then | ||
| 408 | * we have a valid selection otherwise we have | ||
| 409 | * an inactive selection. | ||
| 410 | */ | ||
| 411 | if (cur_s->activated) { | ||
| 412 | *data = cur_s->data; | ||
| 413 | ret_val = XM_SUCCESS; | ||
| 414 | } | ||
| 415 | else { | ||
| 416 | ret_val = XM_IA_SELECT; | ||
| 417 | } | ||
| 418 | } | ||
| 419 | else { | ||
| 420 | /* | ||
| 421 | * No selection was current. | ||
| 422 | */ | ||
| 423 | ret_val = XM_NO_SELECT; | ||
| 424 | } | ||
| 425 | selection = True; | ||
| 426 | break; | ||
| 427 | default: | ||
| 428 | /* | ||
| 429 | * If AEQ mode is enabled then queue the event. | ||
| 430 | */ | ||
| 431 | if (menu->aeq) { | ||
| 432 | feq_tmp = (XMEventQue *)malloc(sizeof(XMEventQue)); | ||
| 433 | if (feq_tmp == NULL) { | ||
| 434 | _XMErrorCode = XME_CALLOC; | ||
| 435 | return(XM_FAILURE); | ||
| 436 | } | ||
| 437 | feq_tmp->event = event; | ||
| 438 | feq_tmp->next = feq; | ||
| 439 | feq = feq_tmp; | ||
| 440 | } | ||
| 441 | else if (_XMEventHandler) (*_XMEventHandler)(&event); | ||
| 442 | } | ||
| 443 | /* | ||
| 444 | * If a selection has been made, break out of the event loop. | ||
| 445 | */ | ||
| 446 | if (selection == True) break; | ||
| 447 | } | ||
| 448 | |||
| 449 | /* | ||
| 450 | * Unmap the menu. | ||
| 451 | */ | ||
| 452 | for ( p_ptr = menu->p_list->next; | ||
| 453 | p_ptr != menu->p_list; | ||
| 454 | p_ptr = p_ptr->next) | ||
| 455 | { | ||
| 456 | XUnmapWindow(display, p_ptr->window); | ||
| 457 | } | ||
| 458 | |||
| 459 | /* | ||
| 460 | * Ungrab the mouse. | ||
| 461 | */ | ||
| 462 | XUngrabPointer(display, CurrentTime); | ||
| 463 | |||
| 464 | /* | ||
| 465 | * Restore bits under where the menu was if we managed | ||
| 466 | * to save them and free the pixmap. | ||
| 467 | */ | ||
| 468 | |||
| 469 | /* | ||
| 470 | * If there is a current selection deactivate it. | ||
| 471 | */ | ||
| 472 | if (cur_s != NULL) cur_s->activated = 0; | ||
| 473 | |||
| 474 | /* | ||
| 475 | * Deactivate the current pane. | ||
| 476 | */ | ||
| 477 | cur_p->activated = 0; | ||
| 478 | XSetWindowBackgroundPixmap(display, cur_p->window, menu->inact_pixmap); | ||
| 479 | |||
| 480 | /* | ||
| 481 | * Synchronize the X buffers and the X event queue. | ||
| 482 | */ | ||
| 483 | XSync(display, 0); | ||
| 484 | |||
| 485 | /* | ||
| 486 | * Dispatch any events remaining on the queue. | ||
| 487 | */ | ||
| 488 | while (QLength(display)) { | ||
| 489 | /* | ||
| 490 | * Fetch the next event. | ||
| 491 | */ | ||
| 492 | XNextEvent(display, &event); | ||
| 493 | |||
| 494 | /* | ||
| 495 | * Discard any events left on the queue that belong to XMenu. | ||
| 496 | * All others are held and then returned to the event queue. | ||
| 497 | */ | ||
| 498 | switch (event.type) { | ||
| 499 | case Expose: | ||
| 500 | case EnterNotify: | ||
| 501 | case LeaveNotify: | ||
| 502 | case ButtonPress: | ||
| 503 | case ButtonRelease: | ||
| 504 | /* | ||
| 505 | * Does this event belong to one of XMenu's windows? | ||
| 506 | * If so, discard it and process the next event. | ||
| 507 | * If not fall through and treat it as a foreign event. | ||
| 508 | */ | ||
| 509 | event_xmp = (XMPane *)XLookUpAssoc( | ||
| 510 | display, | ||
| 511 | menu->assoc_tab, | ||
| 512 | event.xbutton.window | ||
| 513 | ); | ||
| 514 | if (event_xmp != NULL) continue; | ||
| 515 | default: | ||
| 516 | /* | ||
| 517 | * This is a foreign event. | ||
| 518 | * Queue it for later return to the X event queue. | ||
| 519 | */ | ||
| 520 | feq_tmp = (XMEventQue *)malloc(sizeof(XMEventQue)); | ||
| 521 | if (feq_tmp == NULL) { | ||
| 522 | _XMErrorCode = XME_CALLOC; | ||
| 523 | return(XM_FAILURE); | ||
| 524 | } | ||
| 525 | feq_tmp->event = event; | ||
| 526 | feq_tmp->next = feq; | ||
| 527 | feq = feq_tmp; | ||
| 528 | } | ||
| 529 | } | ||
| 530 | /* | ||
| 531 | * Return any foreign events that were queued to the X event queue. | ||
| 532 | */ | ||
| 533 | while (feq != NULL) { | ||
| 534 | feq_tmp = feq; | ||
| 535 | XPutBackEvent(display, &feq_tmp->event); | ||
| 536 | feq = feq_tmp->next; | ||
| 537 | free((char *)feq_tmp); | ||
| 538 | } | ||
| 539 | |||
| 540 | /* | ||
| 541 | * Return successfully. | ||
| 542 | */ | ||
| 543 | _XMErrorCode = XME_NO_ERROR; | ||
| 544 | return(ret_val); | ||
| 545 | |||
| 546 | } | ||
diff --git a/oldXMenu/AddPane.c b/oldXMenu/AddPane.c new file mode 100644 index 00000000000..739cdfe43e8 --- /dev/null +++ b/oldXMenu/AddPane.c | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/AddPane.c,v 1.1 1992/04/11 22:10:17 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuAddPane - Adds a pane to an XMenu object. | ||
| 10 | * | ||
| 11 | * Author: Tony Della Fera, DEC | ||
| 12 | * August, 1985 | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <config.h> | ||
| 17 | #include "XMenuInt.h" | ||
| 18 | |||
| 19 | int | ||
| 20 | XMenuAddPane(display, menu, label, active) | ||
| 21 | Display *display; | ||
| 22 | register XMenu *menu; /* Menu object to be modified. */ | ||
| 23 | register char *label; /* Selection label. */ | ||
| 24 | int active; /* Make selection active? */ | ||
| 25 | { | ||
| 26 | register XMPane *pane; /* Newly created pane. */ | ||
| 27 | register XMSelect *select; /* Initial selection for the new pane. */ | ||
| 28 | |||
| 29 | int label_length; /* Label length in characters. */ | ||
| 30 | int label_width; /* Label width in pixels. */ | ||
| 31 | |||
| 32 | /* | ||
| 33 | * Check for NULL pointers! | ||
| 34 | */ | ||
| 35 | if (label == NULL) { | ||
| 36 | _XMErrorCode = XME_ARG_BOUNDS; | ||
| 37 | return(XM_FAILURE); | ||
| 38 | } | ||
| 39 | |||
| 40 | /* | ||
| 41 | * Calloc the XMPane structure and the initial XMSelect. | ||
| 42 | */ | ||
| 43 | pane = (XMPane *)calloc(1, sizeof(XMPane)); | ||
| 44 | if (pane == NULL) { | ||
| 45 | _XMErrorCode = XME_CALLOC; | ||
| 46 | return(XM_FAILURE); | ||
| 47 | } | ||
| 48 | select = (XMSelect *)calloc(1, sizeof(XMSelect)); | ||
| 49 | if (select == NULL) { | ||
| 50 | _XMErrorCode = XME_CALLOC; | ||
| 51 | return(XM_FAILURE); | ||
| 52 | } | ||
| 53 | |||
| 54 | /* | ||
| 55 | * Determine label size. | ||
| 56 | */ | ||
| 57 | label_length = strlen(label); | ||
| 58 | label_width = XTextWidth(menu->p_fnt_info, | ||
| 59 | label, | ||
| 60 | label_length); | ||
| 61 | |||
| 62 | /* | ||
| 63 | * Set up the initial selection. | ||
| 64 | * Values not explicitly set are zeroed by calloc. | ||
| 65 | */ | ||
| 66 | select->next = select; | ||
| 67 | select->prev = select; | ||
| 68 | select->type = SL_HEADER; | ||
| 69 | select->serial = -1; | ||
| 70 | select->parent_p = pane; | ||
| 71 | |||
| 72 | /* | ||
| 73 | * Fill the XMPane structure. | ||
| 74 | * X and Y position are set to 0 since a recompute will follow. | ||
| 75 | */ | ||
| 76 | pane->type = PANE; | ||
| 77 | pane->active = active; | ||
| 78 | pane->serial = -1; | ||
| 79 | pane->label = label; | ||
| 80 | pane->label_width = label_width; | ||
| 81 | pane->label_length = label_length; | ||
| 82 | pane->s_list = select; | ||
| 83 | |||
| 84 | /* | ||
| 85 | * Insert the pane at the end of the pane list. | ||
| 86 | */ | ||
| 87 | emacs_insque(pane, menu->p_list->prev); | ||
| 88 | |||
| 89 | /* | ||
| 90 | * Update the pane count. | ||
| 91 | */ | ||
| 92 | menu->p_count++; | ||
| 93 | |||
| 94 | /* | ||
| 95 | * Schedule a recompute. | ||
| 96 | */ | ||
| 97 | menu->recompute = 1; | ||
| 98 | |||
| 99 | /* | ||
| 100 | * Return the pane number just added. | ||
| 101 | */ | ||
| 102 | _XMErrorCode = XME_NO_ERROR; | ||
| 103 | return((menu->p_count - 1)); | ||
| 104 | } | ||
diff --git a/oldXMenu/AddSel.c b/oldXMenu/AddSel.c new file mode 100644 index 00000000000..cfb0b3dbcf0 --- /dev/null +++ b/oldXMenu/AddSel.c | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/AddSel.c,v 1.1 1992/04/11 22:10:17 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuAddSelection - Adds a selection to an XMenu object. | ||
| 10 | * | ||
| 11 | * Author: Tony Della Fera, DEC | ||
| 12 | * August, 1985 | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <config.h> | ||
| 17 | #include "XMenuInt.h" | ||
| 18 | |||
| 19 | int | ||
| 20 | XMenuAddSelection(display, menu, p_num, data, label, active) | ||
| 21 | Display *display; | ||
| 22 | register XMenu *menu; /* Menu object to be modified. */ | ||
| 23 | register int p_num; /* Pane number to be modified. */ | ||
| 24 | char *data; /* Data value. */ | ||
| 25 | char *label; /* Selection label. */ | ||
| 26 | int active; /* Make selection active? */ | ||
| 27 | { | ||
| 28 | register XMPane *pane; /* Pane containing the new selection. */ | ||
| 29 | register XMSelect *select; /* Newly created selection. */ | ||
| 30 | |||
| 31 | |||
| 32 | int label_length; /* Label lenght in characters. */ | ||
| 33 | int label_width; /* Label width in pixels. */ | ||
| 34 | |||
| 35 | /* | ||
| 36 | * Check for NULL pointers! | ||
| 37 | */ | ||
| 38 | if (label == NULL) { | ||
| 39 | _XMErrorCode = XME_ARG_BOUNDS; | ||
| 40 | return(XM_FAILURE); | ||
| 41 | } | ||
| 42 | /* | ||
| 43 | * Find the right pane. | ||
| 44 | */ | ||
| 45 | pane = _XMGetPanePtr(menu, p_num); | ||
| 46 | if (pane == NULL) return(XM_FAILURE); | ||
| 47 | |||
| 48 | /* | ||
| 49 | * Calloc the XMSelect structure. | ||
| 50 | */ | ||
| 51 | select = (XMSelect *)calloc(1, sizeof(XMSelect)); | ||
| 52 | if (select == NULL) { | ||
| 53 | _XMErrorCode = XME_CALLOC; | ||
| 54 | return(XM_FAILURE); | ||
| 55 | } | ||
| 56 | /* | ||
| 57 | * Determine label size. | ||
| 58 | */ | ||
| 59 | label_length = strlen(label); | ||
| 60 | label_width = XTextWidth(menu->s_fnt_info, label, label_length); | ||
| 61 | |||
| 62 | /* | ||
| 63 | * Fill the XMSelect structure. | ||
| 64 | */ | ||
| 65 | if (!strcmp (label, "--") || !strcmp (label, "---")) | ||
| 66 | { | ||
| 67 | select->type = SEPARATOR; | ||
| 68 | select->active = 0; | ||
| 69 | } | ||
| 70 | else | ||
| 71 | { | ||
| 72 | select->type = SELECTION; | ||
| 73 | select->active = active; | ||
| 74 | } | ||
| 75 | |||
| 76 | select->serial = -1; | ||
| 77 | select->label = label; | ||
| 78 | select->label_width = label_width; | ||
| 79 | select->label_length = label_length; | ||
| 80 | select->data = data; | ||
| 81 | select->parent_p = pane; | ||
| 82 | |||
| 83 | /* | ||
| 84 | * Insert the selection at the end of the selection list. | ||
| 85 | */ | ||
| 86 | emacs_insque(select, pane->s_list->prev); | ||
| 87 | |||
| 88 | /* | ||
| 89 | * Update the selection count. | ||
| 90 | */ | ||
| 91 | pane->s_count++; | ||
| 92 | |||
| 93 | /* | ||
| 94 | * Schedule a recompute. | ||
| 95 | */ | ||
| 96 | menu->recompute = 1; | ||
| 97 | |||
| 98 | /* | ||
| 99 | * Return the selection number just added. | ||
| 100 | */ | ||
| 101 | _XMErrorCode = XME_NO_ERROR; | ||
| 102 | return((pane->s_count - 1)); | ||
| 103 | } | ||
diff --git a/oldXMenu/ChangeLog b/oldXMenu/ChangeLog new file mode 100644 index 00000000000..9bb8d9c30e9 --- /dev/null +++ b/oldXMenu/ChangeLog | |||
| @@ -0,0 +1,397 @@ | |||
| 1 | 1999-07-12 Richard Stallman <rms@gnu.org> | ||
| 2 | |||
| 3 | * Version 20.4 released. | ||
| 4 | |||
| 5 | 1998-08-19 Richard Stallman <rms@psilocin.ai.mit.edu> | ||
| 6 | |||
| 7 | * Version 20.3 released. | ||
| 8 | |||
| 9 | 1997-09-19 Richard Stallman <rms@psilocin.gnu.ai.mit.edu> | ||
| 10 | |||
| 11 | * Version 20.2 released. | ||
| 12 | |||
| 13 | 1997-09-15 Richard Stallman <rms@psilocin.gnu.ai.mit.edu> | ||
| 14 | |||
| 15 | * Version 20.1 released. | ||
| 16 | |||
| 17 | 1996-08-11 Richard Stallman <rms@psilocin.gnu.ai.mit.edu> | ||
| 18 | |||
| 19 | * Version 19.33 released. | ||
| 20 | |||
| 21 | 1996-07-31 Richard Stallman <rms@psilocin.gnu.ai.mit.edu> | ||
| 22 | |||
| 23 | * Version 19.32 released. | ||
| 24 | |||
| 25 | 1996-06-12 Richard Stallman <rms@psilocin.gnu.ai.mit.edu> | ||
| 26 | |||
| 27 | * Internal.c (_XMRefreshSelection): Check for type SEPARATOR. | ||
| 28 | * InsSel.c (XMenuInsertSelection): Use SEPARATOR if nec. | ||
| 29 | * AddSel.c (XMenuAddSelection): Use SEPARATOR if nec. | ||
| 30 | |||
| 31 | * XMenu.h: New alternative SEPARATOR. | ||
| 32 | |||
| 33 | 1996-05-25 Karl Heuer <kwzh@gnu.ai.mit.edu> | ||
| 34 | |||
| 35 | * Version 19.31 released. | ||
| 36 | |||
| 37 | 1995-11-24 Richard Stallman <rms@mole.gnu.ai.mit.edu> | ||
| 38 | |||
| 39 | * Version 19.30 released. | ||
| 40 | |||
| 41 | 1995-11-13 Richard Stallman <rms@mole.gnu.ai.mit.edu> | ||
| 42 | |||
| 43 | * Makefile.in (ALL_CFLAGS): Add some -I options. | ||
| 44 | |||
| 45 | * Activate.c, AddPane.c, AddSel.c, Create.c, InsPane.c, InsSel.c: | ||
| 46 | * Internal.c, XCrAssoc.c, XMakeAssoc.c: Include config.h. | ||
| 47 | |||
| 48 | 1995-06-19 Richard Stallman <rms@mole.gnu.ai.mit.edu> | ||
| 49 | |||
| 50 | * Version 19.29 released. | ||
| 51 | |||
| 52 | 1995-02-07 Richard Stallman <rms@pogo.gnu.ai.mit.edu> | ||
| 53 | |||
| 54 | * Makefile.in (maintainer-clean): Renamed from realclean. | ||
| 55 | |||
| 56 | 1994-10-25 Richard Stallman <rms@mole.gnu.ai.mit.edu> | ||
| 57 | |||
| 58 | * Makefile.in (ALL_CFLAGS): Reorder the switches more rationally. | ||
| 59 | |||
| 60 | 1994-10-24 Jim Wilson (wilson@chestnut.cygnus.com) | ||
| 61 | |||
| 62 | * Makefile.in (ALL_CFLAGS): Add C_SWITCH_X_MACHINE. | ||
| 63 | |||
| 64 | 1994-09-11 Richard Stallman <rms@mole.gnu.ai.mit.edu> | ||
| 65 | |||
| 66 | * Version 19.27 released. | ||
| 67 | |||
| 68 | 1994-09-07 Richard Stallman <rms@mole.gnu.ai.mit.edu> | ||
| 69 | |||
| 70 | * Version 19.26 released. | ||
| 71 | |||
| 72 | 1994-07-23 Richard Stallman <rms@mole.gnu.ai.mit.edu> | ||
| 73 | |||
| 74 | * Error.c (XMenuError): Make `message' static. | ||
| 75 | |||
| 76 | 1994-06-28 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 77 | |||
| 78 | * Create.c (XAllocDisplayColor): New function. | ||
| 79 | Use it throughout in place of XAllocNamedColor. | ||
| 80 | |||
| 81 | 1994-05-30 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 82 | |||
| 83 | * Version 19.25 released. | ||
| 84 | |||
| 85 | 1994-05-23 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 86 | |||
| 87 | * Version 19.24 released. | ||
| 88 | |||
| 89 | 1994-05-17 Karl Heuer (kwzh@hal.gnu.ai.mit.edu) | ||
| 90 | |||
| 91 | * Create.c (XMenuCreate): Declare `data' as char*. | ||
| 92 | |||
| 93 | 1994-05-16 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 94 | |||
| 95 | * Version 19.23 released. | ||
| 96 | |||
| 97 | 1994-04-12 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 98 | |||
| 99 | * Create.c (XMenuCreate): Declare `data' as unsigned char*. | ||
| 100 | |||
| 101 | 1994-01-03 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 102 | |||
| 103 | * XMakeAssoc.c (XMakeAssoc): Use xmalloc. | ||
| 104 | (_XIOErrorFunction): Decl deleted. | ||
| 105 | |||
| 106 | 1993-11-27 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 107 | |||
| 108 | * Version 19.22 released. | ||
| 109 | |||
| 110 | 1993-11-26 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 111 | |||
| 112 | * Activate.c (XMenuActivate): | ||
| 113 | Call XSetWindowBackground and _XMRefreshPane. | ||
| 114 | |||
| 115 | 1993-11-16 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 116 | |||
| 117 | * Version 19.21 released. | ||
| 118 | |||
| 119 | 1993-11-13 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 120 | |||
| 121 | * Makefile.in (libXMenu11.a): Tell make not to worry if ranlib fails. | ||
| 122 | Tell user too, in case make doesn't pay attention. | ||
| 123 | |||
| 124 | 1993-11-11 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 125 | |||
| 126 | * Version 19.20 released. | ||
| 127 | |||
| 128 | 1993-10-25 Brian Fox (bfox@albert.gnu.ai.mit.edu) | ||
| 129 | |||
| 130 | * Makefile.in (ALL_CFLAGS): Add C_SWITCH_X_SYSTEM. | ||
| 131 | |||
| 132 | 1993-09-27 Brian Fox (bfox@valhalla) | ||
| 133 | |||
| 134 | * Makefile.in (CPP, LN_S, C_SWITCH_X_SITE, CC, CFLAGS): Allow | ||
| 135 | `configure' to supply the values for these variables. | ||
| 136 | |||
| 137 | 1993-09-26 Brian Fox (bfox@ai.mit.edu) | ||
| 138 | |||
| 139 | * Makefile.in (VPATH, srcdir): Now that `configure' creates the | ||
| 140 | Makefiles, do not append the current directory to the value of | ||
| 141 | `srcdir' or `VPATH'. | ||
| 142 | |||
| 143 | 1993-08-14 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 144 | |||
| 145 | * Version 19.19 released. | ||
| 146 | |||
| 147 | 1993-08-08 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 148 | |||
| 149 | * Version 19.18 released. | ||
| 150 | |||
| 151 | 1993-07-30 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 152 | |||
| 153 | * Internal.c (_XMWinQueInit): Use explicit loop, not bzero. | ||
| 154 | |||
| 155 | 1993-07-27 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 156 | |||
| 157 | * Makefile (ALL_CFLAGS): Use all 6 C_SWITCH_... vars. | ||
| 158 | |||
| 159 | Among them, put the ..._SITE vars last. | ||
| 160 | |||
| 161 | 1993-07-18 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu) | ||
| 162 | |||
| 163 | * Version 19.17 released. | ||
| 164 | |||
| 165 | 1993-07-07 Jim Blandy (jimb@geech.gnu.ai.mit.edu) | ||
| 166 | |||
| 167 | * Makefile.in: Write out the dependencies for the object files; | ||
| 168 | otherwise, VPATH won't work. | ||
| 169 | |||
| 170 | * Makefile.in: Re-arrange, to put `all' target at the top. | ||
| 171 | |||
| 172 | 1993-07-06 Jim Blandy (jimb@geech.gnu.ai.mit.edu) | ||
| 173 | |||
| 174 | * Version 19.16 released. | ||
| 175 | |||
| 176 | 1993-06-19 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu) | ||
| 177 | |||
| 178 | * version 19.15 released. | ||
| 179 | |||
| 180 | 1993-06-18 Jim Blandy (jimb@geech.gnu.ai.mit.edu) | ||
| 181 | |||
| 182 | * Makefile.in (ALL_CFLAGS): Always #define EMACS_BITMAP_FILES. | ||
| 183 | This should make it work under any circumstances. | ||
| 184 | |||
| 185 | * Makefile.in (mostlyclean): Use rm -f. | ||
| 186 | |||
| 187 | 1993-06-17 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu) | ||
| 188 | |||
| 189 | * Version 19.14 released. | ||
| 190 | |||
| 191 | 1993-06-17 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 192 | |||
| 193 | * Makefile.in (ALL_CFLAGS): Include C_SWITCH_MACHINE, and CPPFLAGS. | ||
| 194 | Put CFLAGS last. | ||
| 195 | |||
| 196 | 1993-06-16 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu) | ||
| 197 | |||
| 198 | Bring mumbleclean targets into conformance with GNU coding standards. | ||
| 199 | * Makefile.in (mostlyclean, realclean): New targets. | ||
| 200 | |||
| 201 | 1993-06-08 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu) | ||
| 202 | |||
| 203 | * Version 19.13 released. | ||
| 204 | |||
| 205 | 1993-05-30 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 206 | |||
| 207 | * Version 19.10 released. | ||
| 208 | |||
| 209 | 1993-05-29 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 210 | |||
| 211 | * Create.c: Handle EMACS_BITMAP_FILES. | ||
| 212 | Use new names of renamed bitmap files. | ||
| 213 | |||
| 214 | 1993-05-28 Jim Blandy (jimb@geech.gnu.ai.mit.edu) | ||
| 215 | |||
| 216 | * AddPane.c, AddSel.c, DelPane.c, DelSel.c, InsPane.c, InsSel.c, | ||
| 217 | XDelAssoc.c, XMakeAssoc.c, XMenu.h, insque.c: Changed all uses of | ||
| 218 | insque and remque to emacs_insque and emacs_remque, so we can | ||
| 219 | safely include insque.c in the library on all systems. | ||
| 220 | |||
| 221 | 1993-05-27 Jim Blandy (jimb@geech.gnu.ai.mit.edu) | ||
| 222 | |||
| 223 | * Makefile.in (.c.o): Use $< instead of ${srcdir}/$*.c; the latter | ||
| 224 | only works with GNU Make. | ||
| 225 | |||
| 226 | 1993-05-27 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 227 | |||
| 228 | * Create.c (XMenuCreate): Use classes PaneFont and SelectionFont. | ||
| 229 | |||
| 230 | 1993-05-27 Jim Blandy (jimb@geech.gnu.ai.mit.edu) | ||
| 231 | |||
| 232 | * Version 19.9 released. | ||
| 233 | |||
| 234 | 1993-05-27 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 235 | |||
| 236 | * Create.c (XMenuCreate): Use x_get_resource_string, not XGetDefault. | ||
| 237 | |||
| 238 | 1993-05-24 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu) | ||
| 239 | |||
| 240 | * Version 19.8 released. | ||
| 241 | |||
| 242 | 1993-05-23 Jim Blandy (jimb@geech.gnu.ai.mit.edu) | ||
| 243 | |||
| 244 | * Makefile.in (C_SWITCH_X_SITE): New variable, so that the | ||
| 245 | configuration process can correctly implement the --x-includes | ||
| 246 | option. | ||
| 247 | |||
| 248 | 1993-05-22 Jim Blandy (jimb@geech.gnu.ai.mit.edu) | ||
| 249 | |||
| 250 | * Create.c (XMenuCreate): Initialize the menu's pixmaps to None, | ||
| 251 | not NULL. | ||
| 252 | |||
| 253 | 1993-05-22 Jim Blandy (jimb@geech.gnu.ai.mit.edu) | ||
| 254 | |||
| 255 | * Version 19.7 released. | ||
| 256 | |||
| 257 | 1993-05-15 Jim Blandy (jimb@geech.gnu.ai.mit.edu) | ||
| 258 | |||
| 259 | * Makefile.in: Renamed from Makefile, so that the top-level | ||
| 260 | makefile can edit it. | ||
| 261 | |||
| 262 | 1993-04-13 Jim Blandy (jimb@totoro.cs.oberlin.edu) | ||
| 263 | |||
| 264 | * XLookAssoc.c, XMakeAssoc: VMS needs <X11/Xresource.h>, not | ||
| 265 | <X11/Xos.h>. | ||
| 266 | |||
| 267 | * XCrAssoc.c: #include <errno.h>, not "errno.h". | ||
| 268 | (XCreateAssocTable): Doc fix. | ||
| 269 | |||
| 270 | 1993-03-24 Jim Blandy (jimb@geech.gnu.ai.mit.edu) | ||
| 271 | |||
| 272 | * Makefile (.c.o): Include C_SWITCH_SITE and C_SWITCH_SYSTEM in | ||
| 273 | the options to the C compiler. | ||
| 274 | |||
| 275 | * compile.com, descrip.mms: New files for VMS from Richard | ||
| 276 | Levitte. | ||
| 277 | * XCrAssoc.c, XLookAssoc.c, XDestAssoc.c, XDelAssoc.c: Use <angle | ||
| 278 | brackets> around the names of the X Windows #include files; VMS | ||
| 279 | needs this. | ||
| 280 | * XLookAssoc.c, XMakeAssoc.c: #include <X11/Xos.h>. VMS needs | ||
| 281 | this. | ||
| 282 | * Create.c: On VMS, we have to look for the bitmap files in | ||
| 283 | `./src/bitmaps', not <X11/bitmaps>. | ||
| 284 | |||
| 285 | 1993-03-14 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 286 | |||
| 287 | * Makefile (.c.o): Don't rm the .o files. | ||
| 288 | |||
| 289 | 1993-03-13 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 290 | |||
| 291 | * Activate.c (XMenuActivate): If `active' field is negative, | ||
| 292 | don't allow selecting a string. | ||
| 293 | |||
| 294 | 1993-03-09 Jim Blandy (jimb@totoro.cs.oberlin.edu) | ||
| 295 | |||
| 296 | * Create.c (XMenuCreate): New variable `root', holding the | ||
| 297 | display's default root window, so we don't have to write out | ||
| 298 | "RootWindow (display, DefaultScreen (display))" a jillion times. | ||
| 299 | |||
| 300 | * Create.c (XMenuCreate): Don't assume that all the | ||
| 301 | <X11/bitmaps/foo> patterns are 16x16. Instead of building a | ||
| 302 | bitmap and then converting it to a pixmap of the appropriate | ||
| 303 | depth if necessary, build a pixmap of the appropriate depth | ||
| 304 | directly, using XCreatePixmapFromBitmapData. | ||
| 305 | |||
| 306 | * Imakefile: Include XCrAssoc.c, XDelAssoc.c, XDestAssoc.c, | ||
| 307 | XLookAssoc.c, and XMakeAssoc.c in SRCS. Similarly for OBJS. | ||
| 308 | |||
| 309 | * XMenuInt.h: #include <stdio.h> before <X11/Xlib.h>, to avoid | ||
| 310 | warnings about redefining NULL. | ||
| 311 | |||
| 312 | * XMakeAssoc.c, XLookAssoc.c, XDestAssoc.c, XDelAssoc.c, | ||
| 313 | XCrAssoc.c: #include X11/Xlib.h instead of X11/Xlibint.h. | ||
| 314 | |||
| 315 | * XMakeAssoc.c, XLookAssoc.c, XCrAssoc.c: If NULL isn't defined by | ||
| 316 | any of the `.h' files, define it. | ||
| 317 | |||
| 318 | * XMakeAssoc.c, XCrAssoc.c: #include <errno.h>. | ||
| 319 | Add an extern declaration for errno. | ||
| 320 | |||
| 321 | * XMakeAssoc.c: Add an extern declaration for _XIOErrorFunction. | ||
| 322 | (XMakeAssoc): Use malloc instead of Xmalloc to allocate new | ||
| 323 | parts of the assoc table. | ||
| 324 | * XCrAssoc.c (XCreateAssocTable): Same. | ||
| 325 | |||
| 326 | * XDestAssoc.c (XDestroyAssocTable): Use free instead of Xfree. | ||
| 327 | * XDelAssoc.c (XDeleteAssoc): Same. | ||
| 328 | |||
| 329 | 1992-10-18 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 330 | |||
| 331 | * XMakeAssoc.c (XMakeAssoc): Use malloc, not Xmalloc. | ||
| 332 | * XCrAssoc.c (XCreateAssocTable): Use malloc and calloc directly. | ||
| 333 | * XDelAssoc.c (XDeleteAssoc): Use free, not Xfree. | ||
| 334 | * XDestAssoc.c (XDestroyAssocTable): Likewise. | ||
| 335 | |||
| 336 | 1992-10-17 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 337 | |||
| 338 | * XDelAssoc.c, XLookAssoc.c, XCrAssoc.c, XDestAssoc.c, XMakeAssoc.c: | ||
| 339 | Use Xlib.h, not Xlibint.h. | ||
| 340 | * XLookAssoc.c, XMakeAssoc.c, XCrAssoc.c (NULL): Defined. | ||
| 341 | * XMakeAssoc.c, XCrAssoc.c: Include errno.h. Declare errno. | ||
| 342 | * XMakeAssoc.c (_XIOErrorFunction): Declared. | ||
| 343 | |||
| 344 | 1992-09-19 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 345 | |||
| 346 | * XDelAssoc.c, XLookAssoc.c, XCrAssoc.c, XDestAssoc.c, XMakeAssoc.c: | ||
| 347 | Specify dir X11/ when including Xlibint.h. | ||
| 348 | |||
| 349 | 1992-09-17 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 350 | |||
| 351 | * XDelAssoc.c, XLookAssoc.c, XCrAssoc.c, XDestAssoc.c, XMakeAssoc.c: | ||
| 352 | New files. | ||
| 353 | |||
| 354 | * Makefile (SRCS, OBJS): Compile those files. | ||
| 355 | |||
| 356 | 1992-01-31 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 357 | |||
| 358 | * Makefile (clean): Delete object files and library. | ||
| 359 | (distclean): New target. | ||
| 360 | |||
| 361 | 1992-01-29 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 362 | |||
| 363 | * Makefile (libXMenu11.a): Put `-' on ranlib line. | ||
| 364 | |||
| 365 | 1992-01-27 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 366 | |||
| 367 | * Makefile (EXTRA): New variable. | ||
| 368 | (libXMenu11.a): Use that. | ||
| 369 | |||
| 370 | * insque.c: New file. | ||
| 371 | |||
| 372 | 1992-01-26 Richard Stallman (rms@mole.gnu.ai.mit.edu) | ||
| 373 | |||
| 374 | * Makefile (CC): Assignment commented out. | ||
| 375 | |||
| 376 | 1991-11-16 Noah Friedman (friedman at nutrimat) | ||
| 377 | |||
| 378 | * copyright.h: New file (copied from X11R4 distribution) | ||
| 379 | * All files: Replaced occurrences of #include <X11/copyright.h> | ||
| 380 | with #include "copyright.h" | ||
| 381 | |||
| 382 | 1991-10-25 Richard Stallman (rms at mole.gnu.ai.mit.edu) | ||
| 383 | |||
| 384 | * XMenu.h (enum _xmmode): Remove spurious comma. | ||
| 385 | |||
| 386 | * X10.h: New file. | ||
| 387 | * XMenu.h, XMenuInt.h: Include X10.h from this dir. | ||
| 388 | |||
| 389 | 1990-11-13 Richard Stallman (rms at mole.ai.mit.edu) | ||
| 390 | |||
| 391 | * XMenu.h (struct _xmenu): Use unsigned long for colors. | ||
| 392 | |||
| 393 | 1990-11-12 Richard Stallman (rms at mole.ai.mit.edu) | ||
| 394 | |||
| 395 | * Internal.c: Declare argument `display' in some functions. | ||
| 396 | |||
| 397 | |||
diff --git a/oldXMenu/ChgPane.c b/oldXMenu/ChgPane.c new file mode 100644 index 00000000000..e039507180f --- /dev/null +++ b/oldXMenu/ChgPane.c | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/ChgPane.c,v 1.1 1992/04/11 22:10:17 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuChangePane - Change the label of a menu pane. | ||
| 10 | * | ||
| 11 | * Author: Tony Della Fera, DEC | ||
| 12 | * December 19, 1985 | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include "XMenuInt.h" | ||
| 17 | |||
| 18 | int | ||
| 19 | XMenuChangePane(menu, p_num, label) | ||
| 20 | register XMenu *menu; /* Menu object to be modified. */ | ||
| 21 | register int p_num; /* Pane number to be modified. */ | ||
| 22 | char *label; /* Selection label. */ | ||
| 23 | { | ||
| 24 | register XMPane *p_ptr; /* XMPane pointer. */ | ||
| 25 | |||
| 26 | int label_length; /* Label length in characters. */ | ||
| 27 | int label_width; /* Label width in pixels. */ | ||
| 28 | |||
| 29 | /* | ||
| 30 | * Check for NULL pointers! | ||
| 31 | */ | ||
| 32 | if (label == NULL) { | ||
| 33 | _XMErrorCode = XME_ARG_BOUNDS; | ||
| 34 | return(XM_FAILURE); | ||
| 35 | } | ||
| 36 | |||
| 37 | /* | ||
| 38 | * Find the right pane. | ||
| 39 | */ | ||
| 40 | p_ptr = _XMGetPanePtr(menu, p_num); | ||
| 41 | if (p_ptr == NULL) return(XM_FAILURE); | ||
| 42 | |||
| 43 | /* | ||
| 44 | * Determine label size. | ||
| 45 | */ | ||
| 46 | label_length = strlen(label); | ||
| 47 | label_width = XTextWidth(menu->p_fnt_info, label, label_length); | ||
| 48 | |||
| 49 | /* | ||
| 50 | * Change the pane data. | ||
| 51 | */ | ||
| 52 | p_ptr->label = label; | ||
| 53 | p_ptr->label_width = label_width; | ||
| 54 | p_ptr->label_length = label_length; | ||
| 55 | |||
| 56 | /* | ||
| 57 | * Schedule a recompute. | ||
| 58 | */ | ||
| 59 | menu->recompute = 1; | ||
| 60 | |||
| 61 | /* | ||
| 62 | * Return the pane number just changed. | ||
| 63 | */ | ||
| 64 | _XMErrorCode = XME_NO_ERROR; | ||
| 65 | return(p_num); | ||
| 66 | } | ||
diff --git a/oldXMenu/ChgSel.c b/oldXMenu/ChgSel.c new file mode 100644 index 00000000000..591fbb7e886 --- /dev/null +++ b/oldXMenu/ChgSel.c | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/ChgSel.c,v 1.1 1992/04/11 22:10:17 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuChangeSelection - Change a menu selection. | ||
| 10 | * | ||
| 11 | * Author: Tony Della Fera, DEC | ||
| 12 | * December 19, 1985 | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include "XMenuInt.h" | ||
| 17 | |||
| 18 | int | ||
| 19 | XMenuChangeSelection(display, menu, p_num, s_num, data, data_sw, label, label_sw) | ||
| 20 | Display *display; /* previously opened display. */ | ||
| 21 | register XMenu *menu; /* Menu object to be modified. */ | ||
| 22 | register int p_num; /* Pane number to be modified. */ | ||
| 23 | register int s_num; /* Selection number to modified. */ | ||
| 24 | char *data; /* Data value. */ | ||
| 25 | int data_sw; /* Change to new data value? */ | ||
| 26 | char *label; /* Selection label. */ | ||
| 27 | int label_sw; /* Change to new label? */ | ||
| 28 | { | ||
| 29 | register XMPane *p_ptr; /* XMPane pointer. */ | ||
| 30 | register XMSelect *s_ptr; /* XMSelect pointer. */ | ||
| 31 | |||
| 32 | int label_length; /* Label length in characters. */ | ||
| 33 | int label_width; /* Label width in pixels. */ | ||
| 34 | |||
| 35 | /* | ||
| 36 | * Check for NULL pointers! | ||
| 37 | */ | ||
| 38 | if (label == NULL) { | ||
| 39 | _XMErrorCode = XME_ARG_BOUNDS; | ||
| 40 | return(XM_FAILURE); | ||
| 41 | } | ||
| 42 | |||
| 43 | /* | ||
| 44 | * Find the right pane. | ||
| 45 | */ | ||
| 46 | p_ptr = _XMGetPanePtr(menu, p_num); | ||
| 47 | if (p_ptr == NULL) return(XM_FAILURE); | ||
| 48 | |||
| 49 | /* | ||
| 50 | * Find the right selection. | ||
| 51 | */ | ||
| 52 | s_ptr = _XMGetSelectionPtr(p_ptr, s_num); | ||
| 53 | if (s_ptr == NULL) return(XM_FAILURE); | ||
| 54 | |||
| 55 | /* | ||
| 56 | * Reset the label? | ||
| 57 | */ | ||
| 58 | if (label_sw) { | ||
| 59 | /* | ||
| 60 | * Determine label size. | ||
| 61 | */ | ||
| 62 | label_length = strlen(label); | ||
| 63 | label_width = XTextWidth(menu->s_fnt_info, label, label_length); | ||
| 64 | |||
| 65 | /* | ||
| 66 | * Change the selection data. | ||
| 67 | */ | ||
| 68 | s_ptr->label = label; | ||
| 69 | s_ptr->label_width = label_width; | ||
| 70 | s_ptr->label_length = label_length; | ||
| 71 | |||
| 72 | /* | ||
| 73 | * Schedule a recompute. | ||
| 74 | */ | ||
| 75 | menu->recompute = 1; | ||
| 76 | } | ||
| 77 | |||
| 78 | /* | ||
| 79 | * Reset the data? | ||
| 80 | */ | ||
| 81 | if (data_sw) s_ptr->data = data; | ||
| 82 | |||
| 83 | /* | ||
| 84 | * Return successfully. | ||
| 85 | */ | ||
| 86 | _XMErrorCode = XME_NO_ERROR; | ||
| 87 | return(s_num); | ||
| 88 | } | ||
diff --git a/oldXMenu/Create.c b/oldXMenu/Create.c new file mode 100644 index 00000000000..ffbee593421 --- /dev/null +++ b/oldXMenu/Create.c | |||
| @@ -0,0 +1,761 @@ | |||
| 1 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/Create.c,v 1.4 1993/03/09 18:18:01 jimb Exp $ */ | ||
| 2 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 3 | |||
| 4 | #include "copyright.h" | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuCreate - Creates an X window system menu object. | ||
| 10 | * | ||
| 11 | * Author: Tony Della Fera, DEC | ||
| 12 | * January 23, 1986 | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <config.h> | ||
| 17 | #include "XMenuInt.h" | ||
| 18 | |||
| 19 | |||
| 20 | #ifdef EMACS_BITMAP_FILES | ||
| 21 | #include "../src/bitmaps/dimple1.xbm" | ||
| 22 | #include "../src/bitmaps/dimple3.xbm" | ||
| 23 | #include "../src/bitmaps/gray1.xbm" | ||
| 24 | #include "../src/bitmaps/gray3.xbm" | ||
| 25 | #include "../src/bitmaps/crosswv.xbm" | ||
| 26 | |||
| 27 | #include "../src/bitmaps/leftptr.xbm" | ||
| 28 | #include "../src/bitmaps/leftpmsk.xbm" | ||
| 29 | #include "../src/bitmaps/rtptr.xbm" | ||
| 30 | #include "../src/bitmaps/rtpmsk.xbm" | ||
| 31 | #include "../src/bitmaps/cntrptr.xbm" | ||
| 32 | #include "../src/bitmaps/cntrpmsk.xbm" | ||
| 33 | #include "../src/bitmaps/stipple.xbm" | ||
| 34 | |||
| 35 | #else | ||
| 36 | #ifndef VMS | ||
| 37 | |||
| 38 | #include <X11/bitmaps/dimple1> | ||
| 39 | #include <X11/bitmaps/dimple3> | ||
| 40 | #include <X11/bitmaps/gray1> | ||
| 41 | #include <X11/bitmaps/gray3> | ||
| 42 | #include <X11/bitmaps/cross_weave> | ||
| 43 | |||
| 44 | #include <X11/bitmaps/left_ptr> | ||
| 45 | #include <X11/bitmaps/left_ptrmsk> | ||
| 46 | #include <X11/bitmaps/right_ptr> | ||
| 47 | #include <X11/bitmaps/right_ptrmsk> | ||
| 48 | #include <X11/bitmaps/cntr_ptr> | ||
| 49 | #include <X11/bitmaps/cntr_ptrmsk> | ||
| 50 | #include <X11/bitmaps/stipple> | ||
| 51 | |||
| 52 | #else | ||
| 53 | |||
| 54 | #include "[-.src.bitmaps]dimple1.xbm" | ||
| 55 | #include "[-.src.bitmaps]dimple3.xbm" | ||
| 56 | #include "[-.src.bitmaps]gray1.xbm" | ||
| 57 | #include "[-.src.bitmaps]gray3.xbm" | ||
| 58 | #include "[-.src.bitmaps]crosswv.xbm" | ||
| 59 | |||
| 60 | #include "[-.src.bitmaps]leftptr.xbm" | ||
| 61 | #include "[-.src.bitmaps]leftpmsk.xbm" | ||
| 62 | #include "[-.src.bitmaps]rtptr.xbm" | ||
| 63 | #include "[-.src.bitmaps]rtpmsk.xbm" | ||
| 64 | #include "[-.src.bitmaps]cntrptr.xbm" | ||
| 65 | #include "[-.src.bitmaps]cntrpmsk.xbm" | ||
| 66 | #include "[-.src.bitmaps]stipple.xbm" | ||
| 67 | |||
| 68 | #endif /* VMS */ | ||
| 69 | #endif /* not EMACS_BITMAP_FILES */ | ||
| 70 | |||
| 71 | #define DEF_FREEZE 0 | ||
| 72 | #define DEF_REVERSE 0 | ||
| 73 | #define DEF_MENU_STYLE LEFT | ||
| 74 | #define DEF_MENU_MODE BOX | ||
| 75 | #define DEF_INACT_PNUM 3 | ||
| 76 | #define MAX_INACT_PNUM 4 | ||
| 77 | |||
| 78 | #define DEF_P_STYLE CENTER | ||
| 79 | |||
| 80 | #define DEF_P_EVENTS (EnterWindowMask | ExposureMask) | ||
| 81 | #define DEF_P_FNT_NAME "fixed" | ||
| 82 | #define DEF_P_SPREAD 0.5 | ||
| 83 | #define DEF_P_BDR_WIDTH 2 | ||
| 84 | |||
| 85 | #define DEF_S_STYLE LEFT | ||
| 86 | #define DEF_S_EVENTS (EnterWindowMask | LeaveWindowMask) | ||
| 87 | #define DEF_S_FNT_NAME "fixed" | ||
| 88 | #define DEF_S_SPREAD 0.10 | ||
| 89 | #define DEF_S_BDR_WIDTH 1 | ||
| 90 | |||
| 91 | #define XASSOC_TABLE_SIZE 64 | ||
| 92 | |||
| 93 | #define TILE_BUF_SIZE 5 | ||
| 94 | |||
| 95 | int atoi(); | ||
| 96 | double atof(); | ||
| 97 | char *x_get_resource_string (); | ||
| 98 | |||
| 99 | |||
| 100 | |||
| 101 | static Status | ||
| 102 | XAllocDisplayColor(display, map, colorName, color, junk) | ||
| 103 | Display *display; | ||
| 104 | Colormap map; | ||
| 105 | char *colorName; | ||
| 106 | XColor *color; | ||
| 107 | XColor *junk; | ||
| 108 | { | ||
| 109 | return (colorName!=0 && | ||
| 110 | XParseColor(display, map, colorName, color) && | ||
| 111 | XAllocColor(display, map, color)); | ||
| 112 | } | ||
| 113 | |||
| 114 | |||
| 115 | XMenu * | ||
| 116 | XMenuCreate(display, parent, def_env) | ||
| 117 | Display *display; /* ID of previously opened display */ | ||
| 118 | Window parent; /* Window ID of the menu's parent window. */ | ||
| 119 | register char *def_env; /* X Defaults program environment name. */ | ||
| 120 | { | ||
| 121 | register int i; /* Loop counter. */ | ||
| 122 | register int j; /* Loop counter. */ | ||
| 123 | register char *def_val; /* X Default value temp variable. */ | ||
| 124 | |||
| 125 | register XMenu *menu; /* Pointer to the new menu. */ | ||
| 126 | XMStyle menu_style; /* Menu display style. */ | ||
| 127 | XMMode menu_mode; /* Menu display mode. */ | ||
| 128 | XMPane *pane; /* Pane list header. */ | ||
| 129 | XAssocTable *assoc_tab; /* XAssocTable pointer. */ | ||
| 130 | |||
| 131 | int freeze; /* Freeze server mode. */ | ||
| 132 | int reverse; /* Reverse video mode. */ | ||
| 133 | |||
| 134 | XMStyle p_style; /* Pane display style. */ | ||
| 135 | char *p_fnt_name; /* Flag font name. */ | ||
| 136 | XFontStruct *p_fnt_info; /* Flag font structure */ | ||
| 137 | int p_fnt_pad; /* Flag font padding in pixels. */ | ||
| 138 | double p_spread; /* Pane spread in flag height fractions. */ | ||
| 139 | int p_fnt_height; /* Pane character height. */ | ||
| 140 | int p_bdr_width; /* Pane border width. */ | ||
| 141 | int flag_height; /* Flag window height. */ | ||
| 142 | int p_height; /* Pane window height. */ | ||
| 143 | int p_x_off; /* Pane X offset. */ | ||
| 144 | int p_y_off; /* Pane Y offset. */ | ||
| 145 | GC pane_GC; /* Pane graphics context. */ | ||
| 146 | |||
| 147 | XMStyle s_style; /* Selection display style. */ | ||
| 148 | char *s_fnt_name; /* Selection font name. */ | ||
| 149 | XFontStruct *s_fnt_info; /* Selection font structure. */ | ||
| 150 | int s_fnt_pad; /* Selection font padding in pixels. */ | ||
| 151 | int s_fnt_height; /* Selection font character height */ | ||
| 152 | double s_spread; /* Select spread in line height fractions. */ | ||
| 153 | int s_bdr_width; /* Highlight border width. */ | ||
| 154 | int s_height; /* Selection window height. */ | ||
| 155 | int s_x_off; /* Selection window X offset. */ | ||
| 156 | int s_y_off; /* Selection window Y offset. */ | ||
| 157 | GC normal_select_GC; /* GC used for normal video selection. */ | ||
| 158 | GC inverse_select_GC; /* GC used for inverse video selection. */ | ||
| 159 | GC inact_GC; /* GC for inactive pane header and */ | ||
| 160 | /* selections. */ | ||
| 161 | GC inact_GC_noexpose; | ||
| 162 | |||
| 163 | XColor color_def; /* Temp color definition holder. */ | ||
| 164 | XColor screen_def; /* Temp screen color definition holder */ | ||
| 165 | XColor p_bdr_color; /* Color of border. */ | ||
| 166 | XColor s_bdr_color; /* Color of highlight. */ | ||
| 167 | XColor p_frg_color; /* Color of pane foreground color. */ | ||
| 168 | XColor s_frg_color; /* Color of selection foreground. */ | ||
| 169 | XColor bkgnd_color; /* Color of background.. */ | ||
| 170 | XColor mouse_color; /* Color of mouse cursor. */ | ||
| 171 | Cursor mouse_cursor; /* Mouse cursor. */ | ||
| 172 | Pixmap inact_bitmap; /* Menu inactive pixmap. */ | ||
| 173 | |||
| 174 | int inact_pnum; /* Inactive background pattern number. */ | ||
| 175 | |||
| 176 | Pixel p_bdr_pixel; /* Pane border pixel. */ | ||
| 177 | Pixel s_bdr_pixel; /* Selection border pixel. */ | ||
| 178 | Pixel p_frg_pixel; /* Pane foreground pixel. */ | ||
| 179 | Pixel s_frg_pixel; /* Selection foreground pixel. */ | ||
| 180 | Pixel bkgnd_pixel; /* Menu background pixel. */ | ||
| 181 | |||
| 182 | int *width, *height; | ||
| 183 | Pixmap *bitmap; | ||
| 184 | int *x_hot, *y_hot; | ||
| 185 | int status; /* Return code from XReadBitmapFile. */ | ||
| 186 | |||
| 187 | Pixmap cursor; /* Cursor pixmap holder. */ | ||
| 188 | Pixmap cursor_mask; /* Cursor mask pixmap holder. */ | ||
| 189 | Pixmap stipple_pixmap; /* Stipple mask for half-tone text. */ | ||
| 190 | unsigned long valuemask; | ||
| 191 | XGCValues *values; | ||
| 192 | |||
| 193 | Window root = RootWindow (display, DefaultScreen (display)); | ||
| 194 | |||
| 195 | /* | ||
| 196 | * Calloc the XMenu structure and the initial pane. | ||
| 197 | */ | ||
| 198 | menu = (XMenu *)calloc(1, sizeof(XMenu)); | ||
| 199 | if (menu == NULL) { | ||
| 200 | _XMErrorCode = XME_CALLOC; | ||
| 201 | return(NULL); | ||
| 202 | } | ||
| 203 | pane = (XMPane *)calloc(1, sizeof(XMPane)); | ||
| 204 | if (pane == NULL) { | ||
| 205 | _XMErrorCode = XME_CALLOC; | ||
| 206 | return(NULL); | ||
| 207 | } | ||
| 208 | |||
| 209 | /* | ||
| 210 | * Create the XAssocTable | ||
| 211 | */ | ||
| 212 | assoc_tab = (XAssocTable *)XCreateAssocTable(XASSOC_TABLE_SIZE); | ||
| 213 | if(assoc_tab == NULL) { | ||
| 214 | _XMErrorCode= XME_CREATE_ASSOC; | ||
| 215 | return(NULL); | ||
| 216 | } | ||
| 217 | |||
| 218 | /* | ||
| 219 | * Set up the default environment name. | ||
| 220 | */ | ||
| 221 | if (def_env == NULL || *def_env == '\0') def_env = "XMenu"; | ||
| 222 | |||
| 223 | /* | ||
| 224 | * Set up internal fail-safe defaults. | ||
| 225 | */ | ||
| 226 | freeze = DEF_FREEZE; | ||
| 227 | reverse = DEF_REVERSE; | ||
| 228 | menu_style = DEF_MENU_STYLE; | ||
| 229 | menu_mode = DEF_MENU_MODE; | ||
| 230 | inact_pnum = DEF_INACT_PNUM; | ||
| 231 | |||
| 232 | p_style = DEF_P_STYLE; | ||
| 233 | p_spread = DEF_P_SPREAD; | ||
| 234 | p_fnt_name = DEF_P_FNT_NAME; | ||
| 235 | p_bdr_width = DEF_P_BDR_WIDTH; | ||
| 236 | |||
| 237 | s_style = DEF_S_STYLE; | ||
| 238 | s_spread = DEF_S_SPREAD; | ||
| 239 | s_fnt_name = DEF_S_FNT_NAME; | ||
| 240 | s_bdr_width = DEF_S_BDR_WIDTH; | ||
| 241 | |||
| 242 | /* | ||
| 243 | * Get default values from X. | ||
| 244 | */ | ||
| 245 | def_val = x_get_resource_string ("menuFreeze", "MenuFreeze"); | ||
| 246 | if (def_val != NULL) { | ||
| 247 | if (strcmp(def_val, "on") == 0) freeze = 1; | ||
| 248 | else if (strcmp(def_val, "off") == 0) freeze = 0; | ||
| 249 | } | ||
| 250 | |||
| 251 | def_val = x_get_resource_string ("menuReverseVideo", "MenuReverseVideo"); | ||
| 252 | if (def_val != NULL) { | ||
| 253 | if (strcmp(def_val, "on") == 0) reverse = 1; | ||
| 254 | else if (strcmp(def_val, "off") == 0) reverse = 0; | ||
| 255 | } | ||
| 256 | |||
| 257 | def_val = x_get_resource_string ("menuStyle", "MenuStyle"); | ||
| 258 | if (def_val != NULL) { | ||
| 259 | if (strcmp(def_val, "right_hand") == 0) menu_style = RIGHT; | ||
| 260 | else if (strcmp(def_val, "left_hand") == 0) menu_style = LEFT; | ||
| 261 | else if (strcmp(def_val, "center") == 0) menu_style = CENTER; | ||
| 262 | } | ||
| 263 | |||
| 264 | def_val = x_get_resource_string ("menuMode", "MenuMode"); | ||
| 265 | if (def_val != NULL) { | ||
| 266 | if (strcmp(def_val, "box") == 0) menu_mode = BOX; | ||
| 267 | else if (strcmp(def_val, "invert") == 0) menu_mode = INVERT; | ||
| 268 | } | ||
| 269 | |||
| 270 | def_val = x_get_resource_string ("menuMouse", "MenuMouse"); | ||
| 271 | if ( | ||
| 272 | def_val != NULL && | ||
| 273 | DisplayCells(display, DefaultScreen(display)) > 2 && | ||
| 274 | XAllocDisplayColor(display, | ||
| 275 | DefaultColormap(display, DefaultScreen(display)), | ||
| 276 | def_val, | ||
| 277 | &mouse_color, &color_def) | ||
| 278 | ); | ||
| 279 | else if (reverse && | ||
| 280 | XAllocDisplayColor(display, | ||
| 281 | DefaultColormap(display, DefaultScreen(display)), | ||
| 282 | "white", | ||
| 283 | &mouse_color, &color_def) | ||
| 284 | ); | ||
| 285 | |||
| 286 | else if (XAllocDisplayColor(display, | ||
| 287 | DefaultColormap(display, DefaultScreen(display)), | ||
| 288 | "black", | ||
| 289 | &mouse_color, &color_def) | ||
| 290 | ); | ||
| 291 | |||
| 292 | else ; | ||
| 293 | |||
| 294 | def_val = x_get_resource_string ("menuBackground", "MenuBackground"); | ||
| 295 | if ( | ||
| 296 | def_val != NULL && | ||
| 297 | DisplayCells(display, DefaultScreen(display)) > 2 && | ||
| 298 | XAllocDisplayColor(display, | ||
| 299 | DefaultColormap(display, DefaultScreen(display)), | ||
| 300 | def_val, | ||
| 301 | &bkgnd_color, &color_def) | ||
| 302 | ); | ||
| 303 | else if (reverse && | ||
| 304 | XAllocDisplayColor(display, | ||
| 305 | DefaultColormap(display, DefaultScreen(display)), | ||
| 306 | "black", | ||
| 307 | &bkgnd_color, &color_def) | ||
| 308 | ); | ||
| 309 | else if (XAllocDisplayColor(display, | ||
| 310 | DefaultColormap(display, DefaultScreen(display)), | ||
| 311 | "white", | ||
| 312 | &bkgnd_color, &color_def) | ||
| 313 | ); | ||
| 314 | else; | ||
| 315 | |||
| 316 | def_val = x_get_resource_string ("menuInactivePattern", "MenuInactivePattern"); | ||
| 317 | if (def_val != NULL) { | ||
| 318 | if (strcmp(def_val, "dimple1") == 0) inact_pnum = 0; | ||
| 319 | else if (strcmp(def_val, "dimple3") == 0) inact_pnum = 1; | ||
| 320 | else if (strcmp(def_val, "gray1") == 0) inact_pnum = 2; | ||
| 321 | else if (strcmp(def_val, "gray3") == 0) inact_pnum = 3; | ||
| 322 | else if (strcmp(def_val, "cross_weave") == 0) inact_pnum = 4; | ||
| 323 | } | ||
| 324 | |||
| 325 | def_val = x_get_resource_string ("paneStyle", "PaneStyle"); | ||
| 326 | if (def_val != NULL) { | ||
| 327 | if (strcmp(def_val, "flush_left") == 0) p_style = LEFT; | ||
| 328 | else if (strcmp(def_val, "flush_right") == 0) p_style = RIGHT; | ||
| 329 | else if (strcmp(def_val, "center") == 0) p_style = CENTER; | ||
| 330 | } | ||
| 331 | |||
| 332 | def_val = x_get_resource_string ("paneFont", "PaneFont"); | ||
| 333 | if (def_val != NULL) p_fnt_name = def_val; | ||
| 334 | |||
| 335 | def_val = x_get_resource_string ("paneForeground", "PaneForeground"); | ||
| 336 | if ( | ||
| 337 | def_val != NULL && | ||
| 338 | DisplayCells(display, DefaultScreen(display)) > 2 | ||
| 339 | ) | ||
| 340 | XAllocDisplayColor(display, DefaultColormap(display, | ||
| 341 | DefaultScreen(display)), | ||
| 342 | def_val, | ||
| 343 | &p_frg_color, &color_def); | ||
| 344 | |||
| 345 | else if (reverse) XAllocDisplayColor(display, | ||
| 346 | DefaultColormap(display, | ||
| 347 | DefaultScreen(display)), | ||
| 348 | "white", | ||
| 349 | &p_frg_color, &color_def); | ||
| 350 | else XAllocDisplayColor(display, | ||
| 351 | DefaultColormap(display, DefaultScreen(display)), | ||
| 352 | "black", | ||
| 353 | &p_frg_color, &color_def); | ||
| 354 | |||
| 355 | def_val = x_get_resource_string ("paneBorder", "PaneBorder"); | ||
| 356 | if ( | ||
| 357 | def_val != NULL && | ||
| 358 | DisplayCells(display, DefaultScreen(display)) > 2 && | ||
| 359 | XAllocDisplayColor(display, | ||
| 360 | DefaultColormap(display, DefaultScreen(display)), | ||
| 361 | def_val, | ||
| 362 | &p_bdr_color, &color_def) | ||
| 363 | ); | ||
| 364 | else if (reverse && | ||
| 365 | XAllocDisplayColor(display, | ||
| 366 | DefaultColormap(display, DefaultScreen(display)), | ||
| 367 | "white", | ||
| 368 | &p_bdr_color, &color_def) | ||
| 369 | ); | ||
| 370 | else XAllocDisplayColor(display, | ||
| 371 | DefaultColormap(display, DefaultScreen(display)), | ||
| 372 | "black", | ||
| 373 | &p_bdr_color, &color_def); | ||
| 374 | |||
| 375 | def_val = x_get_resource_string ("paneBorderWidth", "PaneBorderWidth"); | ||
| 376 | if (def_val != NULL) p_bdr_width = atoi(def_val); | ||
| 377 | |||
| 378 | def_val = x_get_resource_string ("paneSpread", "PaneSpread"); | ||
| 379 | if (def_val != NULL) p_spread = atof(def_val); | ||
| 380 | |||
| 381 | def_val = x_get_resource_string ("selectionStyle", "SelectionStyle"); | ||
| 382 | if (def_val != NULL) { | ||
| 383 | if (strcmp(def_val, "flush_left") == 0) s_style = LEFT; | ||
| 384 | else if (strcmp(def_val, "flush_right") == 0) s_style = RIGHT; | ||
| 385 | else if (strcmp(def_val, "center") == 0) s_style = CENTER; | ||
| 386 | } | ||
| 387 | |||
| 388 | def_val = x_get_resource_string ("selectionFont", "SelectionFont"); | ||
| 389 | if (def_val != NULL) s_fnt_name = def_val; | ||
| 390 | |||
| 391 | def_val = x_get_resource_string ("selectionForeground", "SelectionForeground"); | ||
| 392 | if ( | ||
| 393 | def_val != NULL && | ||
| 394 | DisplayCells(display, DefaultScreen(display)) > 2 && | ||
| 395 | XAllocDisplayColor(display, | ||
| 396 | DefaultColormap(display, DefaultScreen(display)), | ||
| 397 | def_val, | ||
| 398 | &s_frg_color, &color_def) | ||
| 399 | ); | ||
| 400 | else if (reverse && | ||
| 401 | XAllocDisplayColor(display, | ||
| 402 | DefaultColormap(display, DefaultScreen(display)), | ||
| 403 | "white", | ||
| 404 | &s_frg_color, &color_def) | ||
| 405 | ) ; | ||
| 406 | else if (XAllocDisplayColor(display, | ||
| 407 | DefaultColormap(display, DefaultScreen(display)), | ||
| 408 | "black", | ||
| 409 | &s_frg_color, &color_def) | ||
| 410 | ) ; | ||
| 411 | else ; | ||
| 412 | |||
| 413 | |||
| 414 | def_val = x_get_resource_string ("selectionBorder", "SelectionBorder"); | ||
| 415 | if ( | ||
| 416 | def_val != NULL && | ||
| 417 | DisplayCells(display, DefaultScreen(display)) > 2 && | ||
| 418 | XAllocDisplayColor(display, | ||
| 419 | DefaultColormap(display, DefaultScreen(display)), | ||
| 420 | def_val, | ||
| 421 | &s_bdr_color, &color_def) | ||
| 422 | ) ; | ||
| 423 | else if (reverse && | ||
| 424 | XAllocDisplayColor(display, | ||
| 425 | DefaultColormap(display, DefaultScreen(display)), | ||
| 426 | "white", | ||
| 427 | &s_bdr_color, &color_def) | ||
| 428 | ) ; | ||
| 429 | else if (XAllocDisplayColor(display, | ||
| 430 | DefaultColormap(display, DefaultScreen(display)), | ||
| 431 | "black", | ||
| 432 | &s_bdr_color, &color_def) | ||
| 433 | ) ; | ||
| 434 | else ; | ||
| 435 | |||
| 436 | def_val = x_get_resource_string ("selectionBorderWidth", "SelectionBorderWidth"); | ||
| 437 | if (def_val != NULL) s_bdr_width = atoi(def_val); | ||
| 438 | |||
| 439 | def_val = x_get_resource_string ("selectionSpread", "SelectionSpread"); | ||
| 440 | if (def_val != NULL) s_spread = atof(def_val); | ||
| 441 | |||
| 442 | /* | ||
| 443 | * Create and store the inactive pattern pixmap. | ||
| 444 | */ | ||
| 445 | { | ||
| 446 | char *data = NULL; | ||
| 447 | int width, height; | ||
| 448 | |||
| 449 | switch (inact_pnum) | ||
| 450 | { | ||
| 451 | case 0: | ||
| 452 | data = (char *)dimple1_bits; | ||
| 453 | width = dimple1_width; | ||
| 454 | height = dimple1_height; | ||
| 455 | break; | ||
| 456 | |||
| 457 | case 1: | ||
| 458 | data = (char *)dimple3_bits; | ||
| 459 | width = dimple3_width; | ||
| 460 | height = dimple3_height; | ||
| 461 | break; | ||
| 462 | |||
| 463 | case 2: | ||
| 464 | data = (char *)gray1_bits; | ||
| 465 | width = gray1_width; | ||
| 466 | height = gray1_height; | ||
| 467 | break; | ||
| 468 | |||
| 469 | case 3: | ||
| 470 | data = (char *)gray3_bits; | ||
| 471 | width = gray3_width; | ||
| 472 | height = gray3_height; | ||
| 473 | break; | ||
| 474 | |||
| 475 | case 4: | ||
| 476 | data = (char *)cross_weave_bits; | ||
| 477 | width = cross_weave_width; | ||
| 478 | height = cross_weave_height; | ||
| 479 | break; | ||
| 480 | } | ||
| 481 | |||
| 482 | if (! data) | ||
| 483 | { | ||
| 484 | _XMErrorCode = XME_STORE_BITMAP; | ||
| 485 | return(NULL); | ||
| 486 | } | ||
| 487 | |||
| 488 | inact_bitmap = | ||
| 489 | XCreatePixmapFromBitmapData | ||
| 490 | (display, root, data, width, height, | ||
| 491 | p_frg_color.pixel, bkgnd_color.pixel, | ||
| 492 | DisplayPlanes (display, DefaultScreen (display))); | ||
| 493 | } | ||
| 494 | |||
| 495 | /* | ||
| 496 | * Load the mouse cursor. | ||
| 497 | */ | ||
| 498 | |||
| 499 | switch (menu_style) { | ||
| 500 | case LEFT: | ||
| 501 | cursor = XCreateBitmapFromData(display, | ||
| 502 | root, | ||
| 503 | left_ptr_bits, | ||
| 504 | left_ptr_width, | ||
| 505 | left_ptr_height); | ||
| 506 | cursor_mask = XCreateBitmapFromData(display, | ||
| 507 | root, | ||
| 508 | left_ptrmsk_bits, | ||
| 509 | left_ptrmsk_width, | ||
| 510 | left_ptrmsk_height); | ||
| 511 | mouse_cursor = XCreatePixmapCursor( | ||
| 512 | display, | ||
| 513 | cursor, cursor_mask, | ||
| 514 | &mouse_color, &bkgnd_color, | ||
| 515 | left_ptr_x_hot, | ||
| 516 | left_ptr_y_hot | ||
| 517 | ); | ||
| 518 | XFreePixmap(display, cursor); | ||
| 519 | XFreePixmap(display, cursor_mask); | ||
| 520 | break; | ||
| 521 | case RIGHT: | ||
| 522 | cursor = XCreateBitmapFromData(display, | ||
| 523 | root, | ||
| 524 | right_ptr_bits, | ||
| 525 | right_ptr_width, | ||
| 526 | right_ptr_height); | ||
| 527 | cursor_mask = XCreateBitmapFromData(display, | ||
| 528 | root, | ||
| 529 | right_ptrmsk_bits, | ||
| 530 | right_ptrmsk_width, | ||
| 531 | right_ptrmsk_height); | ||
| 532 | mouse_cursor = XCreatePixmapCursor( | ||
| 533 | display, | ||
| 534 | cursor, cursor_mask, | ||
| 535 | &mouse_color, &bkgnd_color, | ||
| 536 | right_ptr_x_hot, | ||
| 537 | right_ptr_y_hot | ||
| 538 | ); | ||
| 539 | XFreePixmap(display, cursor); | ||
| 540 | XFreePixmap(display, cursor_mask); | ||
| 541 | break; | ||
| 542 | case CENTER: | ||
| 543 | cursor = XCreateBitmapFromData(display, | ||
| 544 | root, | ||
| 545 | cntr_ptr_bits, | ||
| 546 | cntr_ptr_width, | ||
| 547 | cntr_ptr_height); | ||
| 548 | cursor_mask = XCreateBitmapFromData(display, | ||
| 549 | root, | ||
| 550 | cntr_ptrmsk_bits, | ||
| 551 | cntr_ptrmsk_width, | ||
| 552 | cntr_ptrmsk_height); | ||
| 553 | mouse_cursor = XCreatePixmapCursor( | ||
| 554 | display, | ||
| 555 | cursor, cursor_mask, | ||
| 556 | &mouse_color, &bkgnd_color, | ||
| 557 | cntr_ptr_x_hot, | ||
| 558 | cntr_ptr_y_hot | ||
| 559 | ); | ||
| 560 | XFreePixmap(display, cursor); | ||
| 561 | XFreePixmap(display, cursor_mask); | ||
| 562 | break; | ||
| 563 | default: | ||
| 564 | /* Error! Invalid style parameter. */ | ||
| 565 | _XMErrorCode = XME_STYLE_PARAM; | ||
| 566 | return(NULL); | ||
| 567 | } | ||
| 568 | if (mouse_cursor == _X_FAILURE) { | ||
| 569 | _XMErrorCode = XME_CREATE_CURSOR; | ||
| 570 | return(NULL); | ||
| 571 | } | ||
| 572 | |||
| 573 | /* | ||
| 574 | * Open the pane and selection fonts. | ||
| 575 | */ | ||
| 576 | |||
| 577 | p_fnt_info = XLoadQueryFont(display, p_fnt_name); | ||
| 578 | if (p_fnt_info == NULL) { | ||
| 579 | _XMErrorCode = XME_OPEN_FONT; | ||
| 580 | return(NULL); | ||
| 581 | |||
| 582 | } | ||
| 583 | |||
| 584 | s_fnt_info = XLoadQueryFont(display, s_fnt_name); | ||
| 585 | if (s_fnt_info == NULL) { | ||
| 586 | _XMErrorCode = XME_OPEN_FONT; | ||
| 587 | return(NULL); | ||
| 588 | } | ||
| 589 | /* | ||
| 590 | * Calculate the fixed padding value in pixels for each font. | ||
| 591 | */ | ||
| 592 | p_fnt_height = p_fnt_info->max_bounds.ascent + p_fnt_info->max_bounds.descent; | ||
| 593 | s_fnt_height = s_fnt_info->max_bounds.ascent + s_fnt_info->max_bounds.descent; | ||
| 594 | p_fnt_pad = s_spread * p_fnt_height; | ||
| 595 | s_fnt_pad = s_spread * s_fnt_height; | ||
| 596 | |||
| 597 | /* | ||
| 598 | * Calculate fixed height and offset requirements. | ||
| 599 | */ | ||
| 600 | flag_height = p_fnt_height + (p_fnt_pad << 1); | ||
| 601 | |||
| 602 | p_height = 0; | ||
| 603 | p_y_off = flag_height + p_bdr_width; | ||
| 604 | p_x_off = p_y_off * p_spread; | ||
| 605 | |||
| 606 | s_height = s_fnt_height + (s_fnt_pad << 1) + (s_bdr_width << 1); | ||
| 607 | s_y_off = s_height; | ||
| 608 | s_x_off = p_x_off; | ||
| 609 | |||
| 610 | /* | ||
| 611 | * Set up the pane list header. | ||
| 612 | */ | ||
| 613 | pane->next = pane; | ||
| 614 | pane->prev = pane; | ||
| 615 | pane->type = PL_HEADER; | ||
| 616 | pane->serial = -1; | ||
| 617 | |||
| 618 | /* | ||
| 619 | * Initialize the internal pane and selection creation queues. | ||
| 620 | */ | ||
| 621 | _XMWinQueInit(); | ||
| 622 | |||
| 623 | /* | ||
| 624 | * Create pane, active, and inactive GC's. | ||
| 625 | */ | ||
| 626 | values = (XGCValues *)malloc(sizeof(XGCValues)); | ||
| 627 | valuemask = (GCForeground | GCBackground | GCFont | GCLineWidth); | ||
| 628 | |||
| 629 | /* | ||
| 630 | * First, pane. | ||
| 631 | */ | ||
| 632 | |||
| 633 | values->foreground = p_frg_color.pixel; | ||
| 634 | values->background = bkgnd_color.pixel; | ||
| 635 | values->font = p_fnt_info->fid; | ||
| 636 | values->line_width = p_bdr_width; | ||
| 637 | |||
| 638 | pane_GC = XCreateGC( | ||
| 639 | display, | ||
| 640 | root, | ||
| 641 | valuemask, | ||
| 642 | values); | ||
| 643 | /* | ||
| 644 | * Then normal video selection. | ||
| 645 | */ | ||
| 646 | |||
| 647 | values->foreground = s_frg_color.pixel; | ||
| 648 | values->background = bkgnd_color.pixel; | ||
| 649 | values->font = s_fnt_info->fid; | ||
| 650 | values->line_width = s_bdr_width; | ||
| 651 | normal_select_GC = XCreateGC(display, | ||
| 652 | root, | ||
| 653 | valuemask, | ||
| 654 | values); | ||
| 655 | /* | ||
| 656 | * Inverse video selection. | ||
| 657 | */ | ||
| 658 | |||
| 659 | values->foreground = bkgnd_color.pixel; | ||
| 660 | values->background = s_frg_color.pixel; | ||
| 661 | values->font = s_fnt_info->fid; | ||
| 662 | values->line_width = s_bdr_width; | ||
| 663 | inverse_select_GC = XCreateGC(display, | ||
| 664 | root, | ||
| 665 | valuemask, | ||
| 666 | values); | ||
| 667 | stipple_pixmap = XCreateBitmapFromData(display, | ||
| 668 | root, | ||
| 669 | stipple_bits, | ||
| 670 | stipple_width, | ||
| 671 | stipple_height); | ||
| 672 | |||
| 673 | /* | ||
| 674 | * Finally, inactive pane header and selections | ||
| 675 | */ | ||
| 676 | valuemask |= (GCFillStyle | GCStipple); | ||
| 677 | values->foreground = s_frg_color.pixel; | ||
| 678 | values->background = bkgnd_color.pixel; | ||
| 679 | values->font = s_fnt_info->fid; | ||
| 680 | values->line_width = s_bdr_width; | ||
| 681 | values->fill_style = FillStippled; | ||
| 682 | values->stipple = stipple_pixmap; | ||
| 683 | |||
| 684 | inact_GC = XCreateGC(display, | ||
| 685 | root, | ||
| 686 | valuemask, | ||
| 687 | values); | ||
| 688 | |||
| 689 | valuemask |= (GCGraphicsExposures); | ||
| 690 | values->graphics_exposures = False; | ||
| 691 | inact_GC_noexpose = XCreateGC (display, | ||
| 692 | root, | ||
| 693 | valuemask, values); | ||
| 694 | |||
| 695 | |||
| 696 | /* | ||
| 697 | * Construct the XMenu object. | ||
| 698 | */ | ||
| 699 | /* -------------------- Menu data -------------------- */ | ||
| 700 | menu->menu_style = menu_style; | ||
| 701 | menu->menu_mode = menu_mode; | ||
| 702 | menu->freeze = freeze; | ||
| 703 | menu->aeq = 0; | ||
| 704 | menu->recompute = 1; | ||
| 705 | menu->parent = parent; | ||
| 706 | menu->height = 0; | ||
| 707 | menu->width = 0; | ||
| 708 | menu->mouse_cursor = mouse_cursor; | ||
| 709 | menu->assoc_tab = assoc_tab; | ||
| 710 | menu->p_list = pane; | ||
| 711 | /* -------------------- Pane window data -------------------- */ | ||
| 712 | menu->p_style = p_style; | ||
| 713 | menu->p_events = DEF_P_EVENTS; | ||
| 714 | menu->p_fnt_info = p_fnt_info; | ||
| 715 | menu->p_fnt_pad = p_fnt_pad; | ||
| 716 | menu->p_spread = p_spread; | ||
| 717 | menu->p_bdr_width = p_bdr_width; | ||
| 718 | menu->flag_height = flag_height; | ||
| 719 | menu->p_width = 0; | ||
| 720 | menu->p_height = p_height; | ||
| 721 | menu->p_x_off = p_x_off; | ||
| 722 | menu->p_y_off = p_y_off; | ||
| 723 | menu->p_count = 0; | ||
| 724 | menu->pane_GC = pane_GC; | ||
| 725 | menu->x_pos = 0; | ||
| 726 | menu->y_pos = 0; | ||
| 727 | /* -------------------- Selection window data -------------------- */ | ||
| 728 | menu->s_style = s_style; | ||
| 729 | menu->s_events = DEF_S_EVENTS; | ||
| 730 | menu->s_fnt_info = s_fnt_info; | ||
| 731 | menu->s_fnt_pad = s_fnt_pad; | ||
| 732 | menu->s_spread = s_spread; | ||
| 733 | menu->s_bdr_width = s_bdr_width; /* unnecessary */ | ||
| 734 | menu->s_width = 0; | ||
| 735 | menu->s_height = s_height; | ||
| 736 | menu->s_x_off = s_x_off; | ||
| 737 | menu->s_y_off = s_y_off; | ||
| 738 | menu->s_count = 0; | ||
| 739 | menu->normal_select_GC = normal_select_GC; | ||
| 740 | menu->inverse_select_GC = inverse_select_GC; | ||
| 741 | menu->inact_GC = inact_GC; | ||
| 742 | /* -------------------- Color data -------------------- */ | ||
| 743 | menu->p_bdr_color = p_bdr_color.pixel; | ||
| 744 | menu->s_bdr_color = s_bdr_color.pixel; | ||
| 745 | menu->p_frg_color = p_frg_color.pixel; | ||
| 746 | menu->s_frg_color = s_frg_color.pixel; | ||
| 747 | menu->bkgnd_color = bkgnd_color.pixel; | ||
| 748 | /* -------------------- Pixmap data -------------------- */ | ||
| 749 | menu->p_bdr_pixmap = None; | ||
| 750 | menu->s_bdr_pixmap = None; | ||
| 751 | menu->p_frg_pixmap = None; | ||
| 752 | menu->s_frg_pixmap = None; | ||
| 753 | menu->bkgnd_pixmap = None; | ||
| 754 | menu->inact_pixmap = inact_bitmap; | ||
| 755 | |||
| 756 | /* | ||
| 757 | * Return the completed XMenu. | ||
| 758 | */ | ||
| 759 | _XMErrorCode = XME_NO_ERROR; | ||
| 760 | return(menu); | ||
| 761 | } | ||
diff --git a/oldXMenu/DelPane.c b/oldXMenu/DelPane.c new file mode 100644 index 00000000000..cf0354920ce --- /dev/null +++ b/oldXMenu/DelPane.c | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/DelPane.c,v 1.1 1992/04/11 22:10:18 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuDeletePane - Deletes a pane from an XMenu object. | ||
| 10 | * | ||
| 11 | * Author: Tony Della Fera, DEC | ||
| 12 | * 20-Nov-85 | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include "XMenuInt.h" | ||
| 17 | |||
| 18 | int | ||
| 19 | XMenuDeletePane(display, menu, p_num) | ||
| 20 | register Display *display; /* Previously opened display */ | ||
| 21 | register XMenu *menu; /* Menu object to be modified. */ | ||
| 22 | register int p_num; /* Pane number to be deleted. */ | ||
| 23 | { | ||
| 24 | register XMPane *p_ptr; /* Pointer to pane being deleted. */ | ||
| 25 | register XMSelect *s_ptr; /* Pointer to selections being deleted. */ | ||
| 26 | register XMSelect *s_next; /* Pointer to next selection to be deleted. */ | ||
| 27 | |||
| 28 | /* | ||
| 29 | * Find the right pane. | ||
| 30 | */ | ||
| 31 | p_ptr = _XMGetPanePtr(menu, p_num); | ||
| 32 | if (p_ptr == NULL) return(XM_FAILURE); | ||
| 33 | |||
| 34 | /* | ||
| 35 | * Remove the pane from the association table. | ||
| 36 | */ | ||
| 37 | XDeleteAssoc(display, menu->assoc_tab, p_ptr->window); | ||
| 38 | |||
| 39 | /* | ||
| 40 | * Remove the pane from the pane list and update | ||
| 41 | * the pane count. | ||
| 42 | */ | ||
| 43 | emacs_remque(p_ptr); | ||
| 44 | menu->p_count--; | ||
| 45 | |||
| 46 | /* | ||
| 47 | * Remove all the selections in the pane from the | ||
| 48 | * association table and free their XMSelect structures. | ||
| 49 | */ | ||
| 50 | for ( | ||
| 51 | s_ptr = p_ptr->s_list->next; | ||
| 52 | s_ptr != p_ptr->s_list; | ||
| 53 | s_ptr = s_next | ||
| 54 | ) { | ||
| 55 | XDeleteAssoc(display, menu->assoc_tab, s_ptr->window); | ||
| 56 | s_next = s_ptr->next; | ||
| 57 | free(s_ptr); | ||
| 58 | } | ||
| 59 | free(p_ptr->s_list); | ||
| 60 | |||
| 61 | if (p_ptr->window) { | ||
| 62 | /* | ||
| 63 | * Destroy the selection transparencies. | ||
| 64 | */ | ||
| 65 | XDestroySubwindows(display, p_ptr->window); | ||
| 66 | |||
| 67 | /* | ||
| 68 | * Destroy the pane window. | ||
| 69 | */ | ||
| 70 | XDestroyWindow(display, p_ptr->window); | ||
| 71 | } | ||
| 72 | |||
| 73 | /* | ||
| 74 | * Free the pane's XMPane structure. | ||
| 75 | */ | ||
| 76 | free(p_ptr); | ||
| 77 | |||
| 78 | /* | ||
| 79 | * Schedule a recompute. | ||
| 80 | */ | ||
| 81 | menu->recompute = 1; | ||
| 82 | |||
| 83 | /* | ||
| 84 | * Return the pane number just deleted. | ||
| 85 | */ | ||
| 86 | _XMErrorCode = XME_NO_ERROR; | ||
| 87 | return(p_num); | ||
| 88 | } | ||
diff --git a/oldXMenu/DelSel.c b/oldXMenu/DelSel.c new file mode 100644 index 00000000000..9f520860df8 --- /dev/null +++ b/oldXMenu/DelSel.c | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/DelSel.c,v 1.1 1992/04/11 22:10:18 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuDeleteSelection - Deletes a selection from an XMenu object. | ||
| 10 | * | ||
| 11 | * Author: Tony Della Fera, DEC | ||
| 12 | * 20-Nov-85 | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include "XMenuInt.h" | ||
| 17 | |||
| 18 | int | ||
| 19 | XMenuDeleteSelection(display, menu, p_num, s_num) | ||
| 20 | register Display *display; /* Previously opened display. */ | ||
| 21 | register XMenu *menu; /* Menu object to be modified. */ | ||
| 22 | register int p_num; /* Pane number to be deleted. */ | ||
| 23 | register int s_num; /* Selection number to be deleted. */ | ||
| 24 | { | ||
| 25 | register XMPane *p_ptr; /* Pointer to pane being deleted. */ | ||
| 26 | register XMSelect *s_ptr; /* Pointer to selections being deleted. */ | ||
| 27 | |||
| 28 | /* | ||
| 29 | * Find the right pane. | ||
| 30 | */ | ||
| 31 | p_ptr = _XMGetPanePtr(menu, p_num); | ||
| 32 | if (p_ptr == NULL) return(XM_FAILURE); | ||
| 33 | |||
| 34 | /* | ||
| 35 | * Find the right selection. | ||
| 36 | */ | ||
| 37 | s_ptr = _XMGetSelectionPtr(p_ptr, s_num); | ||
| 38 | if (s_ptr == NULL) return(XM_FAILURE); | ||
| 39 | |||
| 40 | /* | ||
| 41 | * Remove the selection from the association table. | ||
| 42 | */ | ||
| 43 | XDeleteAssoc(display, menu->assoc_tab, s_ptr->window); | ||
| 44 | |||
| 45 | /* | ||
| 46 | * Remove the selection from the parent pane's selection | ||
| 47 | * list and update the selection count. | ||
| 48 | */ | ||
| 49 | emacs_remque(s_ptr); | ||
| 50 | p_ptr->s_count--; | ||
| 51 | |||
| 52 | /* | ||
| 53 | * Destroy the selection transparency. | ||
| 54 | */ | ||
| 55 | if (s_ptr->window) XDestroyWindow(display, s_ptr->window); | ||
| 56 | |||
| 57 | /* | ||
| 58 | * Free the selection's XMSelect structure. | ||
| 59 | */ | ||
| 60 | free(s_ptr); | ||
| 61 | |||
| 62 | /* | ||
| 63 | * Schedule a recompute. | ||
| 64 | */ | ||
| 65 | menu->recompute = 1; | ||
| 66 | |||
| 67 | /* | ||
| 68 | * Return the selection number just deleted. | ||
| 69 | */ | ||
| 70 | _XMErrorCode = XME_NO_ERROR; | ||
| 71 | return(s_num); | ||
| 72 | } | ||
diff --git a/oldXMenu/Destroy.c b/oldXMenu/Destroy.c new file mode 100644 index 00000000000..b7f34fc4788 --- /dev/null +++ b/oldXMenu/Destroy.c | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/Destroy.c,v 1.1 1992/04/11 22:10:18 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuDestroy - Free all resources associated with and XMenu. | ||
| 10 | * | ||
| 11 | * Author: Tony Della Fera, DEC | ||
| 12 | * August, 1985 | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include "XMenuInt.h" | ||
| 17 | |||
| 18 | XMenuDestroy(display, menu) | ||
| 19 | Display *display; | ||
| 20 | register XMenu *menu; /* Menu object to destroy. */ | ||
| 21 | { | ||
| 22 | register XMPane *p_ptr; /* Pointer to the current pane. */ | ||
| 23 | register XMPane *p_next; /* Pointer to the next pane. */ | ||
| 24 | register XMSelect *s_ptr; /* Pointer to the current selection. */ | ||
| 25 | register XMSelect *s_next; /* Pointer to the next selection. */ | ||
| 26 | |||
| 27 | /* | ||
| 28 | * Destroy the selection and pane X windows and free | ||
| 29 | * their corresponding XMWindows. | ||
| 30 | */ | ||
| 31 | for ( | ||
| 32 | p_ptr = menu->p_list->next; | ||
| 33 | p_ptr != menu->p_list; | ||
| 34 | p_ptr = p_next | ||
| 35 | ) { | ||
| 36 | for ( | ||
| 37 | s_ptr = p_ptr->s_list->next; | ||
| 38 | s_ptr != p_ptr->s_list; | ||
| 39 | s_ptr = s_next | ||
| 40 | ) { | ||
| 41 | s_next = s_ptr->next; | ||
| 42 | free(s_ptr); | ||
| 43 | } | ||
| 44 | if (p_ptr->window) { | ||
| 45 | XDestroySubwindows(display, p_ptr->window); | ||
| 46 | XDestroyWindow(display, p_ptr->window); | ||
| 47 | } | ||
| 48 | p_next = p_ptr->next; | ||
| 49 | free(p_ptr); | ||
| 50 | } | ||
| 51 | |||
| 52 | /* | ||
| 53 | * Destroy the association table. | ||
| 54 | */ | ||
| 55 | XDestroyAssocTable(menu->assoc_tab); | ||
| 56 | |||
| 57 | /* | ||
| 58 | * Free the mouse cursor. | ||
| 59 | */ | ||
| 60 | XFreeCursor(display, menu->mouse_cursor); | ||
| 61 | |||
| 62 | /* | ||
| 63 | * Free the fonts. | ||
| 64 | */ | ||
| 65 | XFreeFont(display, menu->p_fnt_info); | ||
| 66 | XFreeFont(display, menu->s_fnt_info); | ||
| 67 | |||
| 68 | /* | ||
| 69 | * Free the pixmaps. | ||
| 70 | */ | ||
| 71 | /* XFreePixmap(display, menu->p_bdr_pixmap); | ||
| 72 | XFreePixmap(display, menu->s_bdr_pixmap); | ||
| 73 | XFreePixmap(display, menu->p_frg_pixmap); | ||
| 74 | XFreePixmap(display, menu->s_frg_pixmap); | ||
| 75 | XFreePixmap(display, menu->bkgnd_pixmap); */ | ||
| 76 | XFreePixmap(display, menu->inact_pixmap); | ||
| 77 | |||
| 78 | /* | ||
| 79 | * Free the color cells. | ||
| 80 | */ | ||
| 81 | if ((menu->p_bdr_color != BlackPixel(display, DefaultScreen(display))) && (menu->p_bdr_color != WhitePixel(display, DefaultScreen(display)))) | ||
| 82 | XFreeColors( | ||
| 83 | display, | ||
| 84 | DefaultColormap(display, DefaultScreen(display)), | ||
| 85 | &menu->p_bdr_color, | ||
| 86 | 1, 0); | ||
| 87 | if ((menu->s_bdr_color != BlackPixel(display, DefaultScreen(display))) && (menu->s_bdr_color != WhitePixel(display, DefaultScreen(display)))) | ||
| 88 | XFreeColors( | ||
| 89 | display, | ||
| 90 | DefaultColormap(display, DefaultScreen(display)), | ||
| 91 | &menu->s_bdr_color, | ||
| 92 | 1, 0); | ||
| 93 | if ((menu->p_frg_color != BlackPixel(display, DefaultScreen(display))) && (menu->p_frg_color != WhitePixel(display, DefaultScreen(display)))) | ||
| 94 | XFreeColors( | ||
| 95 | display, | ||
| 96 | DefaultColormap(display, DefaultScreen(display)), | ||
| 97 | &menu->p_frg_color, | ||
| 98 | 1, 0); | ||
| 99 | if ((menu->s_frg_color != BlackPixel(display, DefaultScreen(display))) && (menu->s_frg_color != WhitePixel(display, DefaultScreen(display)))) | ||
| 100 | XFreeColors( | ||
| 101 | display, | ||
| 102 | DefaultColormap(display, DefaultScreen(display)), | ||
| 103 | &menu->s_frg_color, | ||
| 104 | 1, 0); | ||
| 105 | if ((menu->bkgnd_color != BlackPixel(display, DefaultScreen(display))) && (menu->bkgnd_color != WhitePixel(display, DefaultScreen(display)))) | ||
| 106 | XFreeColors( | ||
| 107 | display, | ||
| 108 | DefaultColormap(display, DefaultScreen(display)), | ||
| 109 | &menu->bkgnd_color, | ||
| 110 | 1, 0); | ||
| 111 | |||
| 112 | /* | ||
| 113 | * Free the XMenu. | ||
| 114 | */ | ||
| 115 | free(menu); | ||
| 116 | } | ||
diff --git a/oldXMenu/Error.c b/oldXMenu/Error.c new file mode 100644 index 00000000000..80f227209a6 --- /dev/null +++ b/oldXMenu/Error.c | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/Error.c,v 1.1 1992/04/11 22:10:18 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuError - Returns a string description of the current | ||
| 10 | * XMenu error status flag. | ||
| 11 | * | ||
| 12 | * Author: Tony Della Fera, DEC | ||
| 13 | * August, 1985 | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "XMenuInt.h" | ||
| 18 | |||
| 19 | char * | ||
| 20 | XMenuError() | ||
| 21 | { | ||
| 22 | static char message[128]; /* Error message buffer. */ | ||
| 23 | |||
| 24 | if ((_XMErrorCode < XME_CODE_COUNT) && (_XMErrorCode >= 0)) { | ||
| 25 | return(_XMErrorList[_XMErrorCode]); | ||
| 26 | } | ||
| 27 | sprintf(message, "Unknown _XMErrorCode: %d", _XMErrorCode); | ||
| 28 | return(message); | ||
| 29 | } | ||
| 30 | |||
diff --git a/oldXMenu/EvHand.c b/oldXMenu/EvHand.c new file mode 100644 index 00000000000..375ea44841f --- /dev/null +++ b/oldXMenu/EvHand.c | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/EvHand.c,v 1.1 1992/04/11 22:10:19 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuEventHandler - Set the XMenu asynchronous event handler. | ||
| 10 | * | ||
| 11 | * Author: Tony Della Fera, DEC | ||
| 12 | * December 19, 1985 | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include "XMenuInt.h" | ||
| 17 | |||
| 18 | XMenuEventHandler(handler) | ||
| 19 | int (*handler)(); | ||
| 20 | { | ||
| 21 | /* | ||
| 22 | * Set the global event handler variable. | ||
| 23 | */ | ||
| 24 | _XMEventHandler = handler; | ||
| 25 | } | ||
| 26 | |||
diff --git a/oldXMenu/FindPane.c b/oldXMenu/FindPane.c new file mode 100644 index 00000000000..a4bed439076 --- /dev/null +++ b/oldXMenu/FindPane.c | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/FindPane.c,v 1.1 1992/04/11 22:10:19 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuFindPane - Find the first menu pane who's label matches a | ||
| 10 | * particular string. | ||
| 11 | * | ||
| 12 | * Author: Tony Della Fera, DEC | ||
| 13 | * January 22, 1986 | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "XMenuInt.h" | ||
| 18 | |||
| 19 | int | ||
| 20 | XMenuFindPane(menu, label) | ||
| 21 | register XMenu *menu; | ||
| 22 | register char *label; | ||
| 23 | { | ||
| 24 | register XMPane *p_ptr; | ||
| 25 | register int i = 0; | ||
| 26 | |||
| 27 | /* | ||
| 28 | * Check for NULL pointers! | ||
| 29 | */ | ||
| 30 | if (label == NULL) { | ||
| 31 | _XMErrorCode = XME_ARG_BOUNDS; | ||
| 32 | return(XM_FAILURE); | ||
| 33 | } | ||
| 34 | |||
| 35 | /* | ||
| 36 | * Find the pane who's label matches the given label. | ||
| 37 | */ | ||
| 38 | for ( | ||
| 39 | p_ptr = menu->p_list->next; | ||
| 40 | p_ptr != menu->p_list; | ||
| 41 | p_ptr = p_ptr->next | ||
| 42 | ){ | ||
| 43 | if (p_ptr->label_length == 0) { | ||
| 44 | if (*label == '\0') { | ||
| 45 | _XMErrorCode = XME_NO_ERROR; | ||
| 46 | return (i); | ||
| 47 | } | ||
| 48 | } | ||
| 49 | else { | ||
| 50 | if (strncmp (label, p_ptr->label, p_ptr->label_length) == 0) { | ||
| 51 | _XMErrorCode = XME_NO_ERROR; | ||
| 52 | return (i); | ||
| 53 | } | ||
| 54 | } | ||
| 55 | i++; | ||
| 56 | } | ||
| 57 | |||
| 58 | /* | ||
| 59 | * If we get here then we have not found | ||
| 60 | * a match. | ||
| 61 | */ | ||
| 62 | _XMErrorCode = XME_P_NOT_FOUND; | ||
| 63 | return (XM_FAILURE); | ||
| 64 | } | ||
diff --git a/oldXMenu/FindSel.c b/oldXMenu/FindSel.c new file mode 100644 index 00000000000..97853fae05d --- /dev/null +++ b/oldXMenu/FindSel.c | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/FindSel.c,v 1.1 1992/04/11 22:10:19 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuFindSelection - Find the first selection in a pane who's | ||
| 10 | * label matches a particular string. | ||
| 11 | * | ||
| 12 | * Author: Tony Della Fera, DEC | ||
| 13 | * January 22, 1986 | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "XMenuInt.h" | ||
| 18 | |||
| 19 | int | ||
| 20 | XMenuFindSelection(menu, p_num, label) | ||
| 21 | register XMenu *menu; | ||
| 22 | int p_num; | ||
| 23 | register char *label; | ||
| 24 | { | ||
| 25 | register XMPane *p_ptr; | ||
| 26 | register XMSelect *s_ptr; | ||
| 27 | register int i = 0; | ||
| 28 | |||
| 29 | /* | ||
| 30 | * Check for NULL pointers! | ||
| 31 | */ | ||
| 32 | if (label == NULL) { | ||
| 33 | _XMErrorCode = XME_ARG_BOUNDS; | ||
| 34 | return(XM_FAILURE); | ||
| 35 | } | ||
| 36 | |||
| 37 | /* | ||
| 38 | * Find the right pane. | ||
| 39 | */ | ||
| 40 | p_ptr = _XMGetPanePtr(menu, p_num); | ||
| 41 | if (p_ptr == NULL) return(XM_FAILURE); | ||
| 42 | |||
| 43 | /* | ||
| 44 | * Find the right selection. | ||
| 45 | */ | ||
| 46 | for ( | ||
| 47 | s_ptr = p_ptr->s_list->next; | ||
| 48 | s_ptr != p_ptr->s_list; | ||
| 49 | s_ptr = s_ptr->next | ||
| 50 | ){ | ||
| 51 | if (s_ptr->label_length == 0) { | ||
| 52 | if (*label == '\0') { | ||
| 53 | _XMErrorCode = XME_NO_ERROR; | ||
| 54 | return (i); | ||
| 55 | } | ||
| 56 | } | ||
| 57 | else { | ||
| 58 | if (strncmp (label, s_ptr->label, s_ptr->label_length) == 0) { | ||
| 59 | _XMErrorCode = XME_NO_ERROR; | ||
| 60 | return (i); | ||
| 61 | } | ||
| 62 | } | ||
| 63 | i++; | ||
| 64 | } | ||
| 65 | |||
| 66 | /* | ||
| 67 | * If we get here then we have not found | ||
| 68 | * a match. | ||
| 69 | */ | ||
| 70 | _XMErrorCode = XME_S_NOT_FOUND; | ||
| 71 | return (XM_FAILURE); | ||
| 72 | } | ||
diff --git a/oldXMenu/Imakefile b/oldXMenu/Imakefile new file mode 100644 index 00000000000..8f69bdbc5f8 --- /dev/null +++ b/oldXMenu/Imakefile | |||
| @@ -0,0 +1,97 @@ | |||
| 1 | HEADERS = XMenu.h | ||
| 2 | LINTLIBS = ../lib/X/llib-lX.ln | ||
| 3 | INSTALLFLAGS = $(INSTINCFLAGS) | ||
| 4 | RANLIB = ranlib -t | ||
| 5 | |||
| 6 | SRCS = Activate.c \ | ||
| 7 | AddPane.c \ | ||
| 8 | AddSel.c \ | ||
| 9 | ChgPane.c \ | ||
| 10 | ChgSel.c \ | ||
| 11 | Create.c \ | ||
| 12 | DelPane.c \ | ||
| 13 | DelSel.c \ | ||
| 14 | Destroy.c \ | ||
| 15 | Error.c \ | ||
| 16 | EvHand.c \ | ||
| 17 | FindPane.c \ | ||
| 18 | FindSel.c \ | ||
| 19 | InsPane.c \ | ||
| 20 | InsSel.c \ | ||
| 21 | Internal.c \ | ||
| 22 | Locate.c \ | ||
| 23 | Post.c \ | ||
| 24 | Recomp.c \ | ||
| 25 | SetAEQ.c \ | ||
| 26 | SetFrz.c \ | ||
| 27 | SetPane.c \ | ||
| 28 | SetSel.c \ | ||
| 29 | XCrAssoc.c \ | ||
| 30 | XDelAssoc.c \ | ||
| 31 | XDestAssoc.c \ | ||
| 32 | XLookAssoc.c \ | ||
| 33 | XMakeAssoc.c | ||
| 34 | |||
| 35 | OBJS = Activate.o \ | ||
| 36 | AddPane.o \ | ||
| 37 | AddSel.o \ | ||
| 38 | ChgPane.o \ | ||
| 39 | ChgSel.o \ | ||
| 40 | Create.o \ | ||
| 41 | DelPane.o \ | ||
| 42 | DelSel.o \ | ||
| 43 | Destroy.o \ | ||
| 44 | Error.o \ | ||
| 45 | EvHand.o \ | ||
| 46 | FindPane.o \ | ||
| 47 | FindSel.o \ | ||
| 48 | InsPane.o \ | ||
| 49 | InsSel.o \ | ||
| 50 | Internal.o \ | ||
| 51 | Locate.o \ | ||
| 52 | Post.o \ | ||
| 53 | Recomp.o \ | ||
| 54 | SetAEQ.o \ | ||
| 55 | SetFrz.o \ | ||
| 56 | SetPane.o \ | ||
| 57 | SetSel.o \ | ||
| 58 | XCrAssoc.o \ | ||
| 59 | XDelAssoc.o \ | ||
| 60 | XDestAssoc.o \ | ||
| 61 | XLookAssoc.o \ | ||
| 62 | XMakeAssoc.o | ||
| 63 | |||
| 64 | #if DebugOldLibXMenu && ProfileOldLibXMenu | ||
| 65 | DebuggedAndProfiledLibraryObjectRule() | ||
| 66 | #else | ||
| 67 | # if DebugOldLibXMenu | ||
| 68 | DebuggedLibraryObjectRule() | ||
| 69 | # else | ||
| 70 | # if ProfileOldLibXMenu | ||
| 71 | ProfiledLibraryObjectRule() | ||
| 72 | # else | ||
| 73 | NormalLibraryObjectRule() | ||
| 74 | # endif | ||
| 75 | # endif | ||
| 76 | #endif | ||
| 77 | |||
| 78 | NormalLibraryTarget(XMenu11,$(OBJS)) | ||
| 79 | LintLibraryTarget(XMenu11,$(SRCS)) | ||
| 80 | InstallLibrary(XMenu11,$(USRLIBDIR)) | ||
| 81 | #if InstallLintLibs | ||
| 82 | InstallLintLibrary(XMenu11,$(LINTLIBDIR)) | ||
| 83 | #endif | ||
| 84 | InstallMultiple($(HEADERS),$(INCDIR)) | ||
| 85 | |||
| 86 | #if ProfileOldLibXMenu | ||
| 87 | ProfiledLibraryTarget(XMenu11,$(OBJS)) | ||
| 88 | InstallLibrary(XMenu11_p,$(USRLIBDIR)) | ||
| 89 | #endif | ||
| 90 | |||
| 91 | #if DebugOldLibXMenu | ||
| 92 | DebuggedLibraryTarget(XMenu11,$(OBJS)) | ||
| 93 | #endif | ||
| 94 | |||
| 95 | DependTarget() | ||
| 96 | |||
| 97 | NormalLintTarget($(SRCS)) | ||
diff --git a/oldXMenu/InsPane.c b/oldXMenu/InsPane.c new file mode 100644 index 00000000000..7a0d6e3ec63 --- /dev/null +++ b/oldXMenu/InsPane.c | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/InsPane.c,v 1.1 1992/04/11 22:10:19 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuInsertPane - Inserts a pane into an XMenu object in | ||
| 10 | * a particular position. | ||
| 11 | * | ||
| 12 | * Author: Tony Della Fera, DEC | ||
| 13 | * 20-Nov-85 | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include <config.h> | ||
| 18 | #include "XMenuInt.h" | ||
| 19 | |||
| 20 | int | ||
| 21 | XMenuInsertPane(menu, p_num, label, active) | ||
| 22 | register XMenu *menu; /* Menu object to be modified. */ | ||
| 23 | register int p_num; /* Pane number of new pane. */ | ||
| 24 | char *label; /* Selection label. */ | ||
| 25 | int active; /* Make selection active? */ | ||
| 26 | { | ||
| 27 | register XMPane *p_ptr; /* XMPane pointer. */ | ||
| 28 | register XMPane *pane; /* Newly created pane. */ | ||
| 29 | register XMSelect *select; /* Initial selection for the new pane. */ | ||
| 30 | |||
| 31 | int label_length; /* Label length in characters. */ | ||
| 32 | int label_width; /* Label width in pixels. */ | ||
| 33 | |||
| 34 | /* | ||
| 35 | * Check for NULL pointers! | ||
| 36 | */ | ||
| 37 | if (label == NULL) { | ||
| 38 | _XMErrorCode = XME_ARG_BOUNDS; | ||
| 39 | return(XM_FAILURE); | ||
| 40 | } | ||
| 41 | |||
| 42 | /* | ||
| 43 | * Find the pane number one less than the one specified since that | ||
| 44 | * is the pane after which the insertion will occur. | ||
| 45 | */ | ||
| 46 | p_ptr = _XMGetPanePtr(menu, (p_num - 1)); | ||
| 47 | if (p_ptr == NULL) return(XM_FAILURE); | ||
| 48 | |||
| 49 | /* | ||
| 50 | * Calloc the XMPane structure and the initial XMSelect. | ||
| 51 | */ | ||
| 52 | pane = (XMPane *)calloc(1, sizeof(XMPane)); | ||
| 53 | if (pane == NULL) { | ||
| 54 | _XMErrorCode = XME_CALLOC; | ||
| 55 | return(XM_FAILURE); | ||
| 56 | } | ||
| 57 | select = (XMSelect *)calloc(1, sizeof(XMSelect)); | ||
| 58 | if (select == NULL) { | ||
| 59 | _XMErrorCode = XME_CALLOC; | ||
| 60 | return(XM_FAILURE); | ||
| 61 | } | ||
| 62 | |||
| 63 | /* | ||
| 64 | * Determine label size. | ||
| 65 | */ | ||
| 66 | label_length = strlen(label); | ||
| 67 | label_width = XTextWidth(menu->p_fnt_info, label, label_length); | ||
| 68 | |||
| 69 | /* | ||
| 70 | * Set up the initial selection. | ||
| 71 | * Values not explicitly set are zeroed by calloc. | ||
| 72 | */ | ||
| 73 | select->next = select; | ||
| 74 | select->prev = select; | ||
| 75 | select->type = SL_HEADER; | ||
| 76 | select->serial = -1; | ||
| 77 | select->parent_p = pane; | ||
| 78 | |||
| 79 | /* | ||
| 80 | * Fill the XMPane structure. | ||
| 81 | */ | ||
| 82 | pane->type = PANE; | ||
| 83 | pane->active = active; | ||
| 84 | pane->serial = -1; | ||
| 85 | pane->label = label; | ||
| 86 | pane->label_width = label_width; | ||
| 87 | pane->label_length = label_length; | ||
| 88 | pane->s_list = select; | ||
| 89 | |||
| 90 | /* | ||
| 91 | * Insert the pane after the pane with the pane | ||
| 92 | * number one less than the desired number for the | ||
| 93 | * new pane. | ||
| 94 | */ | ||
| 95 | emacs_insque(pane, p_ptr); | ||
| 96 | |||
| 97 | /* | ||
| 98 | * Update the pane count. | ||
| 99 | */ | ||
| 100 | menu->p_count++; | ||
| 101 | |||
| 102 | /* | ||
| 103 | * Schedule a recompute. | ||
| 104 | */ | ||
| 105 | menu->recompute = 1; | ||
| 106 | |||
| 107 | /* | ||
| 108 | * Return the number of the pane just added. | ||
| 109 | */ | ||
| 110 | _XMErrorCode = XME_NO_ERROR; | ||
| 111 | return(p_num); | ||
| 112 | } | ||
diff --git a/oldXMenu/InsSel.c b/oldXMenu/InsSel.c new file mode 100644 index 00000000000..200f57574ef --- /dev/null +++ b/oldXMenu/InsSel.c | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/InsSel.c,v 1.1 1992/04/11 22:10:19 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuInsertSelection - Inserts a selection into an XMenu object | ||
| 10 | * | ||
| 11 | * Author: Tony Della Fera, DEC | ||
| 12 | * 20-Nov-85 | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <config.h> | ||
| 17 | #include "XMenuInt.h" | ||
| 18 | |||
| 19 | int | ||
| 20 | XMenuInsertSelection(menu, p_num, s_num, data, label, active) | ||
| 21 | register XMenu *menu; /* Menu object to be modified. */ | ||
| 22 | register int p_num; /* Pane number to be modified. */ | ||
| 23 | register int s_num; /* Selection number of new selection. */ | ||
| 24 | char *data; /* Data value. */ | ||
| 25 | char *label; /* Selection label. */ | ||
| 26 | int active; /* Make selection active? */ | ||
| 27 | { | ||
| 28 | register XMPane *p_ptr; /* XMPane pointer. */ | ||
| 29 | register XMSelect *s_ptr; /* XMSelect pointer. */ | ||
| 30 | |||
| 31 | XMSelect *select; /* Newly created selection. */ | ||
| 32 | |||
| 33 | int label_length; /* Label length in characters. */ | ||
| 34 | int label_width; /* Label width in pixels. */ | ||
| 35 | |||
| 36 | /* | ||
| 37 | * Check for NULL pointers! | ||
| 38 | */ | ||
| 39 | if (label == NULL) { | ||
| 40 | _XMErrorCode = XME_ARG_BOUNDS; | ||
| 41 | return(XM_FAILURE); | ||
| 42 | } | ||
| 43 | |||
| 44 | /* | ||
| 45 | * Find the right pane. | ||
| 46 | */ | ||
| 47 | p_ptr = _XMGetPanePtr(menu, p_num); | ||
| 48 | if (p_ptr == NULL) return(XM_FAILURE); | ||
| 49 | |||
| 50 | /* | ||
| 51 | * Find the selection number one less than the one specified since that | ||
| 52 | * is the selection after which the insertion will occur. | ||
| 53 | */ | ||
| 54 | s_ptr = _XMGetSelectionPtr(p_ptr, (s_num - 1)); | ||
| 55 | if (s_ptr == NULL) return(XM_FAILURE); | ||
| 56 | |||
| 57 | /* | ||
| 58 | * Calloc the XMSelect structure. | ||
| 59 | */ | ||
| 60 | select = (XMSelect *)calloc(1, sizeof(XMSelect)); | ||
| 61 | if (select == NULL) { | ||
| 62 | _XMErrorCode = XME_CALLOC; | ||
| 63 | return(XM_FAILURE); | ||
| 64 | } | ||
| 65 | |||
| 66 | /* | ||
| 67 | * Determine label size. | ||
| 68 | */ | ||
| 69 | label_length = strlen(label); | ||
| 70 | label_width = XTextWidth(menu->s_fnt_info, label, label_length); | ||
| 71 | |||
| 72 | |||
| 73 | /* | ||
| 74 | * Fill the XMSelect structure. | ||
| 75 | */ | ||
| 76 | if (!strcmp (label, "--") || !strcmp (label, "---")) | ||
| 77 | { | ||
| 78 | select->type = SEPARATOR; | ||
| 79 | select->active = 0; | ||
| 80 | } | ||
| 81 | else | ||
| 82 | { | ||
| 83 | select->type = SELECTION; | ||
| 84 | select->active = active; | ||
| 85 | } | ||
| 86 | |||
| 87 | select->active = active; | ||
| 88 | select->serial = -1; | ||
| 89 | select->label = label; | ||
| 90 | select->label_width = label_width; | ||
| 91 | select->label_length = label_length; | ||
| 92 | select->data = data; | ||
| 93 | select->parent_p = p_ptr; | ||
| 94 | |||
| 95 | /* | ||
| 96 | * Insert the selection after the selection with the selection | ||
| 97 | * number one less than the desired number for the new selection. | ||
| 98 | */ | ||
| 99 | emacs_insque(select, s_ptr); | ||
| 100 | |||
| 101 | /* | ||
| 102 | * Update the selection count. | ||
| 103 | */ | ||
| 104 | p_ptr->s_count++; | ||
| 105 | |||
| 106 | /* | ||
| 107 | * Schedule a recompute. | ||
| 108 | */ | ||
| 109 | menu->recompute = 1; | ||
| 110 | |||
| 111 | /* | ||
| 112 | * Return the selection number just inserted. | ||
| 113 | */ | ||
| 114 | _XMErrorCode = XME_NO_ERROR; | ||
| 115 | return(s_num); | ||
| 116 | } | ||
diff --git a/oldXMenu/Internal.c b/oldXMenu/Internal.c new file mode 100644 index 00000000000..39a6a3be6a4 --- /dev/null +++ b/oldXMenu/Internal.c | |||
| @@ -0,0 +1,1006 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/Internal.c,v 1.1 1992/04/11 22:10:20 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuInternal.c - XMenu internal (not user visible) routines. | ||
| 10 | * | ||
| 11 | * Author: Tony Della Fera, DEC | ||
| 12 | * November, 1985 | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <config.h> | ||
| 17 | #include "XMenuInt.h" | ||
| 18 | |||
| 19 | /* | ||
| 20 | * Toggle color macro. | ||
| 21 | */ | ||
| 22 | #define toggle_color(x) \ | ||
| 23 | ((x) == menu->bkgnd_color ? menu->s_frg_color : menu->bkgnd_color) | ||
| 24 | |||
| 25 | /* | ||
| 26 | * Internal Window creation queue sizes. | ||
| 27 | */ | ||
| 28 | #define S_QUE_SIZE 300 | ||
| 29 | #define P_QUE_SIZE 20 | ||
| 30 | #define BUFFER_SIZE (S_QUE_SIZE >= P_QUE_SIZE ? S_QUE_SIZE : P_QUE_SIZE) | ||
| 31 | |||
| 32 | |||
| 33 | /* | ||
| 34 | * XMWinQue - Internal window creation queue datatype. | ||
| 35 | */ | ||
| 36 | typedef struct _xmwinquedef { | ||
| 37 | int sq_size; | ||
| 38 | XMSelect *sq[S_QUE_SIZE]; | ||
| 39 | XMSelect **sq_ptr; | ||
| 40 | int pq_size; | ||
| 41 | XMPane *pq[P_QUE_SIZE]; | ||
| 42 | XMPane **pq_ptr; | ||
| 43 | } XMWinQue; | ||
| 44 | |||
| 45 | /* | ||
| 46 | * _XMWinQue - Internal static window creation queue. | ||
| 47 | */ | ||
| 48 | static Bool _XMWinQueIsInit = False; | ||
| 49 | static XMWinQue _XMWinQue; | ||
| 50 | |||
| 51 | /* | ||
| 52 | * _XMErrorCode - Global XMenu error code. | ||
| 53 | */ | ||
| 54 | int _XMErrorCode = XME_NO_ERROR; | ||
| 55 | /* | ||
| 56 | * _XMErrorList - Global XMenu error code description strings. | ||
| 57 | */ | ||
| 58 | char * | ||
| 59 | _XMErrorList[XME_CODE_COUNT] = { | ||
| 60 | "No error", /* XME_NO_ERROR */ | ||
| 61 | "Menu not initialized", /* XME_NOT_INIT */ | ||
| 62 | "Argument out of bounds", /* XME_ARG_BOUNDS */ | ||
| 63 | "Pane not found", /* XME_P_NOT_FOUND */ | ||
| 64 | "Selection not found", /* XME_S_NOT_FOUND */ | ||
| 65 | "Invalid menu style parameter", /* XME_STYLE_PARAM */ | ||
| 66 | "Unable to grab mouse", /* XME_GRAB_MOUSE */ | ||
| 67 | "Unable to interpret locator", /* XME_INTERP_LOC */ | ||
| 68 | "Unable to calloc memory", /* XME_CALLOC */ | ||
| 69 | "Unable to create XAssocTable", /* XME_CREATE_ASSOC */ | ||
| 70 | "Unable to store bitmap", /* XME_STORE_BITMAP */ | ||
| 71 | "Unable to make tile pixmaps", /* XME_MAKE_TILES */ | ||
| 72 | "Unable to make pixmap", /* XME_MAKE_PIXMAP */ | ||
| 73 | "Unable to create cursor", /* XME_CREATE_CURSOR */ | ||
| 74 | "Unable to open font", /* XME_OPEN_FONT */ | ||
| 75 | "Unable to create windows", /* XME_CREATE_WINDOW */ | ||
| 76 | "Unable to create transparencies", /* XME_CREATE_TRANSP */ | ||
| 77 | }; | ||
| 78 | |||
| 79 | /* | ||
| 80 | * _XMEventHandler - Internal event handler variable. | ||
| 81 | */ | ||
| 82 | int (*_XMEventHandler)() = NULL; | ||
| 83 | |||
| 84 | |||
| 85 | |||
| 86 | /* | ||
| 87 | * _XMWinQueInit - Internal routine to initialize the window | ||
| 88 | * queue. | ||
| 89 | */ | ||
| 90 | _XMWinQueInit() | ||
| 91 | { | ||
| 92 | /* | ||
| 93 | * If the queue is not initialized initialize it. | ||
| 94 | */ | ||
| 95 | if (!_XMWinQueIsInit) { | ||
| 96 | /* | ||
| 97 | * Blank the queue structure. | ||
| 98 | */ | ||
| 99 | register int i; | ||
| 100 | |||
| 101 | for (i = 0; i < S_QUE_SIZE; i++) | ||
| 102 | _XMWinQue.sq[i] = 0; | ||
| 103 | |||
| 104 | for (i = 0; i < P_QUE_SIZE; i++) | ||
| 105 | _XMWinQue.pq[i] = 0; | ||
| 106 | |||
| 107 | _XMWinQue.sq_size = _XMWinQue.pq_size = 0; | ||
| 108 | |||
| 109 | /* | ||
| 110 | * Initialize the next free location pointers. | ||
| 111 | */ | ||
| 112 | _XMWinQue.sq_ptr = _XMWinQue.sq; | ||
| 113 | _XMWinQue.pq_ptr = _XMWinQue.pq; | ||
| 114 | } | ||
| 115 | } | ||
| 116 | |||
| 117 | |||
| 118 | |||
| 119 | /* | ||
| 120 | * _XMWinQueAddPane - Internal routine to add a pane to the pane | ||
| 121 | * window queue. | ||
| 122 | */ | ||
| 123 | int | ||
| 124 | _XMWinQueAddPane(display, menu, p_ptr) | ||
| 125 | register Display *display; | ||
| 126 | register XMenu *menu; /* Menu being manipulated. */ | ||
| 127 | register XMPane *p_ptr; /* XMPane being queued. */ | ||
| 128 | { | ||
| 129 | /* | ||
| 130 | * If the queue is currently full then flush it. | ||
| 131 | */ | ||
| 132 | if (_XMWinQue.pq_size == P_QUE_SIZE) { | ||
| 133 | if (_XMWinQueFlush(display, menu, 0, 0) == _FAILURE) return(_FAILURE); | ||
| 134 | } | ||
| 135 | |||
| 136 | /* | ||
| 137 | * Insert the new XMPane pointer and increment the queue pointer | ||
| 138 | * and the queue size. | ||
| 139 | */ | ||
| 140 | *_XMWinQue.pq_ptr = p_ptr; | ||
| 141 | _XMWinQue.pq_ptr++; | ||
| 142 | _XMWinQue.pq_size++; | ||
| 143 | |||
| 144 | /* | ||
| 145 | * All went well, return successfully. | ||
| 146 | */ | ||
| 147 | _XMErrorCode = XME_NO_ERROR; | ||
| 148 | return(_SUCCESS); | ||
| 149 | } | ||
| 150 | |||
| 151 | |||
| 152 | |||
| 153 | /* | ||
| 154 | * _XMWinQueAddSelection - Internal routine to add a selection to | ||
| 155 | * the selection window queue. | ||
| 156 | */ | ||
| 157 | int | ||
| 158 | _XMWinQueAddSelection(display, menu, s_ptr) | ||
| 159 | register Display *display; | ||
| 160 | register XMenu *menu; /* Menu being manipulated. */ | ||
| 161 | register XMSelect *s_ptr; /* XMSelection being queued. */ | ||
| 162 | { | ||
| 163 | /* | ||
| 164 | * If this entry will overflow the queue then flush it. | ||
| 165 | */ | ||
| 166 | if (_XMWinQue.sq_size == S_QUE_SIZE) { | ||
| 167 | if (_XMWinQueFlush(display, menu, 0, 0) == _FAILURE) return(_FAILURE); | ||
| 168 | } | ||
| 169 | |||
| 170 | /* | ||
| 171 | * Insert the new XMSelect pointer and increment the queue pointer | ||
| 172 | * and the queue size. | ||
| 173 | */ | ||
| 174 | *_XMWinQue.sq_ptr = s_ptr; | ||
| 175 | _XMWinQue.sq_ptr++; | ||
| 176 | _XMWinQue.sq_size++; | ||
| 177 | |||
| 178 | /* | ||
| 179 | * All went well, return successfully. | ||
| 180 | */ | ||
| 181 | _XMErrorCode = XME_NO_ERROR; | ||
| 182 | return(_SUCCESS); | ||
| 183 | } | ||
| 184 | |||
| 185 | |||
| 186 | |||
| 187 | /* | ||
| 188 | * _XMWinQueFlush - Internal routine to flush the pane and | ||
| 189 | * selection window queues. | ||
| 190 | */ | ||
| 191 | int | ||
| 192 | _XMWinQueFlush(display, menu, pane, select) | ||
| 193 | register Display *display; | ||
| 194 | register XMenu *menu; /* Menu being manipulated. */ | ||
| 195 | register XMPane *pane; /* Current pane. */ | ||
| 196 | { | ||
| 197 | register int pq_index; /* Pane queue index. */ | ||
| 198 | register int sq_index; /* Selection queue index. */ | ||
| 199 | register XMPane *p_ptr; /* XMPane pointer. */ | ||
| 200 | register XMSelect *s_ptr; /* XMSelect pointer. */ | ||
| 201 | unsigned long valuemask; /* Which attributes to set. */ | ||
| 202 | XSetWindowAttributes *attributes; /* Attributes to be set. */ | ||
| 203 | |||
| 204 | /* | ||
| 205 | * If the pane window queue is not empty... | ||
| 206 | */ | ||
| 207 | |||
| 208 | if (_XMWinQue.pq_size > 0) { | ||
| 209 | /* | ||
| 210 | * set up attributes for pane window to be created. | ||
| 211 | */ | ||
| 212 | valuemask = (CWBackPixmap | CWBorderPixel | CWOverrideRedirect); | ||
| 213 | attributes = (XSetWindowAttributes *)malloc(sizeof(XSetWindowAttributes)); | ||
| 214 | attributes->border_pixel = menu->p_bdr_color; | ||
| 215 | attributes->background_pixmap = menu->inact_pixmap; | ||
| 216 | attributes->override_redirect = True; | ||
| 217 | |||
| 218 | /* | ||
| 219 | * Create all the pending panes in order, so that the | ||
| 220 | * current pane will be on top, with the others | ||
| 221 | * stacked appropriately under it. | ||
| 222 | */ | ||
| 223 | for (pq_index = _XMWinQue.pq_size - 1; | ||
| 224 | pq_index >= 0; | ||
| 225 | pq_index--) | ||
| 226 | { | ||
| 227 | p_ptr = _XMWinQue.pq[pq_index]; /* Retrieve next pane. */ | ||
| 228 | if (p_ptr == pane) break; | ||
| 229 | p_ptr->window = XCreateWindow(display, | ||
| 230 | menu->parent, | ||
| 231 | p_ptr->window_x, | ||
| 232 | p_ptr->window_y, | ||
| 233 | p_ptr->window_w, | ||
| 234 | p_ptr->window_h, | ||
| 235 | menu->p_bdr_width, | ||
| 236 | CopyFromParent, | ||
| 237 | InputOutput, | ||
| 238 | CopyFromParent, | ||
| 239 | valuemask, | ||
| 240 | attributes); | ||
| 241 | XMakeAssoc(display, menu->assoc_tab, p_ptr->window, p_ptr); | ||
| 242 | XSelectInput(display, p_ptr->window, menu->p_events); | ||
| 243 | } | ||
| 244 | for (pq_index = 0; | ||
| 245 | pq_index < _XMWinQue.pq_size; | ||
| 246 | pq_index++) | ||
| 247 | { | ||
| 248 | p_ptr = _XMWinQue.pq[pq_index]; /* Retrieve next pane. */ | ||
| 249 | p_ptr->window = XCreateWindow(display, | ||
| 250 | menu->parent, | ||
| 251 | p_ptr->window_x, | ||
| 252 | p_ptr->window_y, | ||
| 253 | p_ptr->window_w, | ||
| 254 | p_ptr->window_h, | ||
| 255 | menu->p_bdr_width, | ||
| 256 | CopyFromParent, | ||
| 257 | InputOutput, | ||
| 258 | CopyFromParent, | ||
| 259 | valuemask, | ||
| 260 | attributes); | ||
| 261 | XMakeAssoc(display, menu->assoc_tab, p_ptr->window, p_ptr); | ||
| 262 | XSelectInput(display, p_ptr->window, menu->p_events); | ||
| 263 | if (p_ptr == pane) break; | ||
| 264 | } | ||
| 265 | |||
| 266 | /* | ||
| 267 | * Reset the pane queue pointer and size. | ||
| 268 | */ | ||
| 269 | _XMWinQue.pq_size = 0; | ||
| 270 | _XMWinQue.pq_ptr = _XMWinQue.pq; | ||
| 271 | } | ||
| 272 | |||
| 273 | /* | ||
| 274 | * If the selection window queue is not empty... | ||
| 275 | */ | ||
| 276 | |||
| 277 | if (_XMWinQue.sq_size > 0) { | ||
| 278 | |||
| 279 | for (sq_index = 0; sq_index < _XMWinQue.sq_size; sq_index++) { | ||
| 280 | /* | ||
| 281 | * Retrieve the XMSelect pointer. | ||
| 282 | */ | ||
| 283 | s_ptr = _XMWinQue.sq[sq_index]; | ||
| 284 | s_ptr->window = XCreateWindow(display, | ||
| 285 | s_ptr->parent_p->window, | ||
| 286 | s_ptr->window_x, | ||
| 287 | s_ptr->window_y, | ||
| 288 | s_ptr->window_w, | ||
| 289 | s_ptr->window_h, | ||
| 290 | 0, /* border width*/ | ||
| 291 | CopyFromParent, | ||
| 292 | InputOnly, | ||
| 293 | CopyFromParent, | ||
| 294 | 0, | ||
| 295 | attributes); | ||
| 296 | |||
| 297 | /* | ||
| 298 | * Insert the new window id and its | ||
| 299 | * associated XMSelect structure into the | ||
| 300 | * association table. | ||
| 301 | */ | ||
| 302 | XMakeAssoc(display, menu->assoc_tab, s_ptr->window, s_ptr); | ||
| 303 | XSelectInput(display, s_ptr->window, menu->s_events); | ||
| 304 | } | ||
| 305 | |||
| 306 | /* | ||
| 307 | * Reset the selection queue pointer and size. | ||
| 308 | */ | ||
| 309 | _XMWinQue.sq_size = 0; | ||
| 310 | _XMWinQue.sq_ptr = _XMWinQue.sq; | ||
| 311 | } | ||
| 312 | |||
| 313 | /* | ||
| 314 | * Flush X's internal queues. | ||
| 315 | */ | ||
| 316 | XFlush(display); | ||
| 317 | |||
| 318 | /* | ||
| 319 | * All went well, return successfully. | ||
| 320 | */ | ||
| 321 | _XMErrorCode = XME_NO_ERROR; | ||
| 322 | return(_SUCCESS); | ||
| 323 | } | ||
| 324 | |||
| 325 | |||
| 326 | |||
| 327 | /* | ||
| 328 | * _XMGetPanePtr - Given a menu pointer and a pane index number, return | ||
| 329 | * a pane pointer that points to the indexed pane. | ||
| 330 | */ | ||
| 331 | XMPane * | ||
| 332 | _XMGetPanePtr(menu, p_num) | ||
| 333 | register XMenu *menu; /* Menu to find the pane in. */ | ||
| 334 | register int p_num; /* Index number of pane to find. */ | ||
| 335 | { | ||
| 336 | register XMPane *p_ptr; /* Pane pointer to be returned. */ | ||
| 337 | register int i; /* Loop counter. */ | ||
| 338 | |||
| 339 | /* | ||
| 340 | * Is the pane number out of range? | ||
| 341 | */ | ||
| 342 | if ((p_num < 0) || (p_num > (menu->p_count - 1))) { | ||
| 343 | _XMErrorCode = XME_P_NOT_FOUND; | ||
| 344 | return(NULL); | ||
| 345 | } | ||
| 346 | |||
| 347 | /* | ||
| 348 | * Find the right pane. | ||
| 349 | */ | ||
| 350 | p_ptr = menu->p_list->next; | ||
| 351 | for (i = 0; i < p_num; i++) p_ptr = p_ptr->next; | ||
| 352 | |||
| 353 | /* | ||
| 354 | * Return successfully. | ||
| 355 | */ | ||
| 356 | _XMErrorCode = XME_NO_ERROR; | ||
| 357 | return(p_ptr); | ||
| 358 | } | ||
| 359 | |||
| 360 | |||
| 361 | |||
| 362 | /* | ||
| 363 | * _XMGetSelectionPtr - Given pane pointer and a selection index number, | ||
| 364 | * return a selection pointer that points to the | ||
| 365 | * indexed selection. | ||
| 366 | */ | ||
| 367 | XMSelect * | ||
| 368 | _XMGetSelectionPtr(p_ptr, s_num) | ||
| 369 | register XMPane *p_ptr; /* Pane to find the selection in. */ | ||
| 370 | register int s_num; /* Index number of the selection to find. */ | ||
| 371 | { | ||
| 372 | register XMSelect *s_ptr; /* Selection pointer to be returned. */ | ||
| 373 | register int i; /* Loop counter. */ | ||
| 374 | |||
| 375 | /* | ||
| 376 | * Is the selection number out of range? | ||
| 377 | */ | ||
| 378 | if ((s_num < 0) || (s_num > (p_ptr->s_count - 1))) { | ||
| 379 | _XMErrorCode = XME_S_NOT_FOUND; | ||
| 380 | return(NULL); | ||
| 381 | } | ||
| 382 | |||
| 383 | /* | ||
| 384 | * Find the right selection. | ||
| 385 | */ | ||
| 386 | s_ptr = p_ptr->s_list->next; | ||
| 387 | for (i = 0; i < s_num; i++) s_ptr = s_ptr->next; | ||
| 388 | |||
| 389 | /* | ||
| 390 | * Return successfully. | ||
| 391 | */ | ||
| 392 | _XMErrorCode = XME_NO_ERROR; | ||
| 393 | return(s_ptr); | ||
| 394 | } | ||
| 395 | |||
| 396 | |||
| 397 | |||
| 398 | /* | ||
| 399 | * _XMRecomputeGlobals - Internal subroutine to recompute menu wide | ||
| 400 | * global values. | ||
| 401 | */ | ||
| 402 | _XMRecomputeGlobals(display, menu) | ||
| 403 | register Display *display; /*X11 display variable. */ | ||
| 404 | register XMenu *menu; /* Menu object to compute from. */ | ||
| 405 | { | ||
| 406 | register XMPane *p_ptr; /* Pane pointer. */ | ||
| 407 | register XMSelect *s_ptr; /* Selection pointer. */ | ||
| 408 | |||
| 409 | register int max_p_label = 0; /* Maximum pane label width. */ | ||
| 410 | register int max_s_label = 0; /* Maximum selection label width. */ | ||
| 411 | register int s_count = 0; /* Maximum selection count. */ | ||
| 412 | |||
| 413 | int p_s_pad; /* Pane <-> selection padding. */ | ||
| 414 | int p_s_diff; /* Pane <-> selection separation. */ | ||
| 415 | |||
| 416 | int p_height; /* Pane window height. */ | ||
| 417 | int p_width; /* Pane window width. */ | ||
| 418 | int s_width; /* Selection window width. */ | ||
| 419 | |||
| 420 | int screen; /* DefaultScreen holder. */ | ||
| 421 | |||
| 422 | /* | ||
| 423 | * For each pane... | ||
| 424 | */ | ||
| 425 | for ( | ||
| 426 | p_ptr = menu->p_list->next; | ||
| 427 | p_ptr != menu->p_list; | ||
| 428 | p_ptr = p_ptr->next | ||
| 429 | ){ | ||
| 430 | |||
| 431 | /* | ||
| 432 | * Recompute maximum pane label width. | ||
| 433 | */ | ||
| 434 | max_p_label = max(max_p_label, p_ptr->label_width); | ||
| 435 | |||
| 436 | /* | ||
| 437 | * Recompute maximum selection count. | ||
| 438 | */ | ||
| 439 | s_count = max(s_count, p_ptr->s_count); | ||
| 440 | |||
| 441 | /* | ||
| 442 | * For each selection in the current pane... | ||
| 443 | */ | ||
| 444 | for ( | ||
| 445 | s_ptr = p_ptr->s_list->next; | ||
| 446 | s_ptr != p_ptr->s_list; | ||
| 447 | s_ptr = s_ptr->next | ||
| 448 | ){ | ||
| 449 | |||
| 450 | /* | ||
| 451 | * Recompute maximum selection label width. | ||
| 452 | */ | ||
| 453 | max_s_label = max(max_s_label, s_ptr->label_width); | ||
| 454 | } | ||
| 455 | } | ||
| 456 | |||
| 457 | /* | ||
| 458 | * Recompute pane height. | ||
| 459 | */ | ||
| 460 | p_height = (menu->flag_height << 1) + (menu->s_y_off * s_count); | ||
| 461 | |||
| 462 | /* | ||
| 463 | * Recompute horizontal padding between the pane window and the | ||
| 464 | * selection windows. | ||
| 465 | */ | ||
| 466 | p_s_pad = menu->p_x_off << 1; | ||
| 467 | |||
| 468 | /* | ||
| 469 | * Recompute pane and selection window widths. | ||
| 470 | * This is done by first computing the window sizes from the maximum | ||
| 471 | * label widths. If the spacing between the selection window and the | ||
| 472 | * containing pane window is less than the pane selection padding value | ||
| 473 | * (twice the pane X offset) then change the size of the pane to be | ||
| 474 | * the size of the selection window plus the padding. If, however the | ||
| 475 | * spacing between the selection window and the containing pane window | ||
| 476 | * is more than the pane selection padding value increase the size of | ||
| 477 | * the selection to its maximum possible value (the pane width minus | ||
| 478 | * the pane selection padding value). | ||
| 479 | */ | ||
| 480 | p_width = max_p_label + p_s_pad; | ||
| 481 | s_width = max_s_label + (menu->s_fnt_pad << 1) + (menu->s_bdr_width << 1); | ||
| 482 | p_s_diff = p_width - s_width; | ||
| 483 | if (p_s_diff < p_s_pad) { | ||
| 484 | p_width = s_width + p_s_pad; | ||
| 485 | } | ||
| 486 | else if (p_s_diff > p_s_pad) { | ||
| 487 | s_width = p_width - p_s_pad; | ||
| 488 | } | ||
| 489 | |||
| 490 | /* | ||
| 491 | * Reset menu wide global values. | ||
| 492 | */ | ||
| 493 | menu->s_count = s_count; | ||
| 494 | menu->p_height = p_height; | ||
| 495 | menu->p_width = p_width; | ||
| 496 | menu->s_width = s_width; | ||
| 497 | |||
| 498 | /* | ||
| 499 | * Ensure that the origin of the menu is placed so that | ||
| 500 | * None of the panes ore selections are off the screen. | ||
| 501 | */ | ||
| 502 | screen = DefaultScreen(display); | ||
| 503 | if (menu->x_pos + menu->width > DisplayWidth(display, screen)) | ||
| 504 | menu->x_pos = DisplayWidth(display, screen) - menu->width; | ||
| 505 | else if (menu->x_pos < 0) menu->x_pos = 0; | ||
| 506 | if(menu->y_pos + menu->height > DisplayHeight(display, screen)) | ||
| 507 | menu->y_pos = DisplayHeight(display, screen) - menu->height; | ||
| 508 | else if (menu->y_pos < 0) menu->y_pos = 0; | ||
| 509 | } | ||
| 510 | |||
| 511 | |||
| 512 | /* | ||
| 513 | * _XMRecomputePane - Internal subroutine to recompute pane | ||
| 514 | * window dependencies. | ||
| 515 | */ | ||
| 516 | int | ||
| 517 | _XMRecomputePane(display, menu, p_ptr, p_num) | ||
| 518 | register Display *display; /* Standard X display variable. */ | ||
| 519 | register XMenu *menu; /* Menu object being recomputed. */ | ||
| 520 | register XMPane *p_ptr; /* Pane pointer. */ | ||
| 521 | register int p_num; /* Pane sequence number. */ | ||
| 522 | { | ||
| 523 | register int window_x; /* Recomputed window X coordinate. */ | ||
| 524 | register int window_y; /* Recomputed window Y coordinate. */ | ||
| 525 | |||
| 526 | unsigned long change_mask; /* Value mask to reconfigure window. */ | ||
| 527 | XWindowChanges *changes; /* Values to use in configure window. */ | ||
| 528 | |||
| 529 | register Bool config_p = False; /* Reconfigure pane window? */ | ||
| 530 | |||
| 531 | /* | ||
| 532 | * Update the pane serial number. | ||
| 533 | */ | ||
| 534 | p_ptr->serial = p_num; | ||
| 535 | |||
| 536 | /* | ||
| 537 | * Recompute window X and Y coordinates. | ||
| 538 | */ | ||
| 539 | switch (menu->menu_style) { | ||
| 540 | case LEFT: | ||
| 541 | window_x = menu->p_x_off * ((menu->p_count - 1) - p_num); | ||
| 542 | window_y = menu->p_y_off * ((menu->p_count - 1) - p_num); | ||
| 543 | break; | ||
| 544 | case RIGHT: | ||
| 545 | window_x = menu->p_x_off * p_num; | ||
| 546 | window_y = menu->p_y_off * ((menu->p_count - 1) - p_num); | ||
| 547 | break; | ||
| 548 | case CENTER: | ||
| 549 | window_x = 0; | ||
| 550 | window_y = menu->p_y_off * ((menu->p_count - 1) - p_num); | ||
| 551 | break; | ||
| 552 | default: | ||
| 553 | /* Error! Invalid style parameter. */ | ||
| 554 | _XMErrorCode = XME_STYLE_PARAM; | ||
| 555 | return(_FAILURE); | ||
| 556 | } | ||
| 557 | window_x += menu->x_pos; | ||
| 558 | window_y += menu->y_pos; | ||
| 559 | |||
| 560 | /* | ||
| 561 | * If the newly compute pane coordinates differ from the | ||
| 562 | * current coordinates, reset the current coordinates and | ||
| 563 | * reconfigure the pane. | ||
| 564 | */ | ||
| 565 | if ( | ||
| 566 | (window_x != p_ptr->window_x) || | ||
| 567 | (window_y != p_ptr->window_y) | ||
| 568 | ){ | ||
| 569 | /* | ||
| 570 | * Reset the coordinates and schedule | ||
| 571 | * the pane for reconfiguration. | ||
| 572 | */ | ||
| 573 | p_ptr->window_x = window_x; | ||
| 574 | p_ptr->window_y = window_y; | ||
| 575 | config_p = True; | ||
| 576 | } | ||
| 577 | |||
| 578 | /* | ||
| 579 | * If the local pane width and height differs from the | ||
| 580 | * menu pane width and height, reset the local values. | ||
| 581 | */ | ||
| 582 | if ( | ||
| 583 | (p_ptr->window_w != menu->p_width) || | ||
| 584 | (p_ptr->window_h != menu->p_height) | ||
| 585 | ){ | ||
| 586 | /* | ||
| 587 | * Reset window width and height and schedule | ||
| 588 | * the pane for reconfiguration. | ||
| 589 | */ | ||
| 590 | p_ptr->window_w = menu->p_width; | ||
| 591 | p_ptr->window_h = menu->p_height; | ||
| 592 | config_p = True; | ||
| 593 | } | ||
| 594 | |||
| 595 | /* | ||
| 596 | * If we need to reconfigure the pane window do it now. | ||
| 597 | */ | ||
| 598 | if (config_p == True) { | ||
| 599 | /* | ||
| 600 | * If the pane window has already been created then | ||
| 601 | * reconfigure the existing window, otherwise queue | ||
| 602 | * it for creation with the new configuration. | ||
| 603 | */ | ||
| 604 | if (p_ptr->window) { | ||
| 605 | change_mask = (CWX | CWY | CWWidth | CWHeight); | ||
| 606 | changes = (XWindowChanges *)malloc(sizeof(XWindowChanges)); | ||
| 607 | changes->x = p_ptr->window_x; | ||
| 608 | changes->y = p_ptr->window_y; | ||
| 609 | changes->width = p_ptr->window_w; | ||
| 610 | changes->height = p_ptr->window_h; | ||
| 611 | |||
| 612 | XConfigureWindow( | ||
| 613 | display, | ||
| 614 | p_ptr->window, | ||
| 615 | change_mask, | ||
| 616 | changes | ||
| 617 | ); | ||
| 618 | free(changes); | ||
| 619 | |||
| 620 | } | ||
| 621 | else { | ||
| 622 | if (_XMWinQueAddPane(display, menu, p_ptr) == _FAILURE) { | ||
| 623 | return(_FAILURE); | ||
| 624 | } | ||
| 625 | } | ||
| 626 | } | ||
| 627 | |||
| 628 | /* | ||
| 629 | * Recompute label X position. | ||
| 630 | */ | ||
| 631 | switch (menu->p_style) { | ||
| 632 | case LEFT: | ||
| 633 | p_ptr->label_x = menu->p_x_off + menu->p_fnt_pad; | ||
| 634 | break; | ||
| 635 | case RIGHT: | ||
| 636 | p_ptr->label_x = menu->p_width - | ||
| 637 | (p_ptr->label_width + menu->p_x_off + menu->p_fnt_pad); | ||
| 638 | break; | ||
| 639 | case CENTER: | ||
| 640 | p_ptr->label_x = (menu->p_width - p_ptr->label_width) >> 1; | ||
| 641 | break; | ||
| 642 | default: | ||
| 643 | /* Error! Invalid style parameter. */ | ||
| 644 | _XMErrorCode = XME_STYLE_PARAM; | ||
| 645 | return(_FAILURE); | ||
| 646 | } | ||
| 647 | /* | ||
| 648 | * Recompute label Y positions. | ||
| 649 | */ | ||
| 650 | p_ptr->label_uy = menu->p_fnt_pad + menu->p_fnt_info->max_bounds.ascent; | ||
| 651 | p_ptr->label_ly = (menu->p_height - menu->p_fnt_pad - menu->p_fnt_info->max_bounds.descent); | ||
| 652 | |||
| 653 | /* | ||
| 654 | * All went well, return successfully. | ||
| 655 | */ | ||
| 656 | _XMErrorCode = XME_NO_ERROR; | ||
| 657 | return(_SUCCESS); | ||
| 658 | } | ||
| 659 | |||
| 660 | |||
| 661 | |||
| 662 | /* | ||
| 663 | * _XMRecomputeSelection - Internal subroutine to recompute | ||
| 664 | * selection window dependencies. | ||
| 665 | */ | ||
| 666 | int | ||
| 667 | _XMRecomputeSelection(display, menu, s_ptr, s_num) | ||
| 668 | register Display *display; | ||
| 669 | register XMenu *menu; /* Menu object being recomputed. */ | ||
| 670 | register XMSelect *s_ptr; /* Selection pointer. */ | ||
| 671 | register int s_num; /* Selection sequence number. */ | ||
| 672 | { | ||
| 673 | register Bool config_s = False; /* Reconfigure selection window? */ | ||
| 674 | XWindowChanges *changes; /* Values to change in configure. */ | ||
| 675 | unsigned long change_mask; /* Value mask for XConfigureWindow. */ | ||
| 676 | |||
| 677 | /* | ||
| 678 | * If the selection serial numbers are out of order, begin | ||
| 679 | * resequencing selections. Recompute selection window coordinates | ||
| 680 | * and serial number. | ||
| 681 | * | ||
| 682 | * When selections are created they are given a serial number of | ||
| 683 | * -1, this causes this routine to give a new selection | ||
| 684 | * its initial coordinates and serial number. | ||
| 685 | */ | ||
| 686 | if (s_ptr->serial != s_num) { | ||
| 687 | /* | ||
| 688 | * Fix the sequence number. | ||
| 689 | */ | ||
| 690 | s_ptr->serial = s_num; | ||
| 691 | /* | ||
| 692 | * Recompute window X and Y coordinates. | ||
| 693 | */ | ||
| 694 | s_ptr->window_x = menu->s_x_off; | ||
| 695 | s_ptr->window_y = menu->flag_height + (menu->s_y_off * s_num); | ||
| 696 | /* | ||
| 697 | * We must reconfigure the window. | ||
| 698 | */ | ||
| 699 | config_s = True; | ||
| 700 | } | ||
| 701 | |||
| 702 | /* | ||
| 703 | * If the local selection width and height differs from the | ||
| 704 | * menu selection width and height, reset the local values. | ||
| 705 | */ | ||
| 706 | if ( | ||
| 707 | (s_ptr->window_w != menu->s_width) || | ||
| 708 | (s_ptr->window_h != menu->s_height) | ||
| 709 | ){ | ||
| 710 | /* | ||
| 711 | * We must reconfigure the window. | ||
| 712 | */ | ||
| 713 | config_s = True; | ||
| 714 | /* | ||
| 715 | * Reset window width and height. | ||
| 716 | */ | ||
| 717 | s_ptr->window_w = menu->s_width; | ||
| 718 | s_ptr->window_h = menu->s_height; | ||
| 719 | } | ||
| 720 | |||
| 721 | /* | ||
| 722 | * If we need to reconfigure the selection window do it now. | ||
| 723 | */ | ||
| 724 | if (config_s == True) { | ||
| 725 | /* | ||
| 726 | * If the selection window has already been created then | ||
| 727 | * reconfigure the existing window, otherwise queue it | ||
| 728 | * for creation with the new configuration. | ||
| 729 | */ | ||
| 730 | if (s_ptr->window) { | ||
| 731 | changes = (XWindowChanges *)malloc(sizeof(XWindowChanges)); | ||
| 732 | change_mask = (CWX | CWY | CWWidth | CWHeight); | ||
| 733 | changes = (XWindowChanges *)malloc(sizeof(XWindowChanges)); | ||
| 734 | changes->x = s_ptr->window_x; | ||
| 735 | changes->y = s_ptr->window_y; | ||
| 736 | changes->width = s_ptr->window_w; | ||
| 737 | changes->height = s_ptr->window_h; | ||
| 738 | |||
| 739 | XConfigureWindow( | ||
| 740 | display, | ||
| 741 | s_ptr->window, | ||
| 742 | change_mask, | ||
| 743 | changes | ||
| 744 | ); | ||
| 745 | free(changes); | ||
| 746 | |||
| 747 | } | ||
| 748 | else { | ||
| 749 | if (_XMWinQueAddSelection(display, menu, s_ptr) == _FAILURE) { | ||
| 750 | return(_FAILURE); | ||
| 751 | } | ||
| 752 | } | ||
| 753 | } | ||
| 754 | |||
| 755 | /* | ||
| 756 | * Recompute label X position. | ||
| 757 | */ | ||
| 758 | switch (menu->s_style) { | ||
| 759 | case LEFT: | ||
| 760 | s_ptr->label_x = menu->s_bdr_width + menu->s_fnt_pad + s_ptr->window_x; | ||
| 761 | break; | ||
| 762 | case RIGHT: | ||
| 763 | s_ptr->label_x = s_ptr->window_x + menu->s_width - | ||
| 764 | (s_ptr->label_width + menu->s_bdr_width + menu->s_fnt_pad); | ||
| 765 | break; | ||
| 766 | case CENTER: | ||
| 767 | s_ptr->label_x = s_ptr->window_x + ((menu->s_width - s_ptr->label_width) >> 1); | ||
| 768 | break; | ||
| 769 | default: | ||
| 770 | /* Error! Invalid style parameter. */ | ||
| 771 | _XMErrorCode = XME_STYLE_PARAM; | ||
| 772 | return(_FAILURE); | ||
| 773 | } | ||
| 774 | /* | ||
| 775 | * Recompute label Y position. | ||
| 776 | */ | ||
| 777 | s_ptr->label_y = s_ptr->window_y + menu->s_fnt_info->max_bounds.ascent + menu->s_fnt_pad + menu->s_bdr_width; | ||
| 778 | |||
| 779 | /* | ||
| 780 | * All went well, return successfully. | ||
| 781 | */ | ||
| 782 | _XMErrorCode = XME_NO_ERROR; | ||
| 783 | return(_SUCCESS); | ||
| 784 | } | ||
| 785 | |||
| 786 | |||
| 787 | |||
| 788 | /* | ||
| 789 | * _XMTransToOrigin - Internal subroutine to translate the point at | ||
| 790 | * the center of the current pane and selection to the | ||
| 791 | * the menu origin. | ||
| 792 | * | ||
| 793 | * WARNING! ****** Be certain that all menu dependencies have been | ||
| 794 | * recomputed before calling this routine or | ||
| 795 | * unpredictable results will follow. | ||
| 796 | */ | ||
| 797 | _XMTransToOrigin(display, menu, p_ptr, s_ptr, x_pos, y_pos, orig_x, orig_y) | ||
| 798 | Display *display; /* Not used. Included for consistency. */ | ||
| 799 | register XMenu *menu; /* Menu being computed against. */ | ||
| 800 | register XMPane *p_ptr; /* Current pane pointer. */ | ||
| 801 | register XMSelect *s_ptr; /* Current selection pointer. */ | ||
| 802 | int x_pos; /* X coordinate of point to translate. */ | ||
| 803 | int y_pos; /* Y coordinate of point to translate. */ | ||
| 804 | int *orig_x; /* Return value X coord. of the menu origin. */ | ||
| 805 | int *orig_y; /* Return value Y coord. of the menu origin. */ | ||
| 806 | { | ||
| 807 | register int l_orig_x; /* Local X coordinate of the menu origin. */ | ||
| 808 | register int l_orig_y; /* Local Y coordinate of the menu origin. */ | ||
| 809 | |||
| 810 | /* | ||
| 811 | * Translate the menu origin such that the cursor hot point will be in the | ||
| 812 | * center of the desired current selection and pane. | ||
| 813 | * If the current selection pointer is NULL then assume that the hot point | ||
| 814 | * will be in the center of the current pane flag. | ||
| 815 | */ | ||
| 816 | |||
| 817 | if (s_ptr == NULL) { | ||
| 818 | /* | ||
| 819 | * Translate from the center of the pane flag to the upper left | ||
| 820 | * of the current pane window. | ||
| 821 | */ | ||
| 822 | l_orig_x = x_pos - (menu->p_width >> 1) - menu->p_bdr_width; | ||
| 823 | l_orig_y = y_pos - (menu->flag_height >> 1) - menu->p_bdr_width; | ||
| 824 | } | ||
| 825 | else { | ||
| 826 | /* | ||
| 827 | * First translate from the center of the current selection | ||
| 828 | * to the upper left of the current selection window. | ||
| 829 | */ | ||
| 830 | l_orig_x = x_pos - (menu->s_width >> 1); | ||
| 831 | l_orig_y = y_pos - (menu->s_height >> 1); | ||
| 832 | |||
| 833 | /* | ||
| 834 | * Then translate to the upper left of the current pane window. | ||
| 835 | */ | ||
| 836 | l_orig_x -= (s_ptr->window_x + menu->p_bdr_width); | ||
| 837 | l_orig_y -= (s_ptr->window_y + menu->p_bdr_width); | ||
| 838 | } | ||
| 839 | |||
| 840 | /* | ||
| 841 | * Finally translate to the upper left of the menu. | ||
| 842 | */ | ||
| 843 | l_orig_x -= (p_ptr->window_x - menu->x_pos); | ||
| 844 | l_orig_y -= (p_ptr->window_y - menu->y_pos); | ||
| 845 | |||
| 846 | /* | ||
| 847 | * Set the return values. | ||
| 848 | */ | ||
| 849 | *orig_x = l_orig_x; | ||
| 850 | *orig_y = l_orig_y; | ||
| 851 | } | ||
| 852 | |||
| 853 | /* | ||
| 854 | * _XMRefreshPane - Internal subroutine to completely refresh | ||
| 855 | * the contents of a pane. | ||
| 856 | */ | ||
| 857 | _XMRefreshPane(display, menu, pane) | ||
| 858 | register Display *display; | ||
| 859 | register XMenu *menu; | ||
| 860 | register XMPane *pane; | ||
| 861 | { | ||
| 862 | register XMSelect *s_list = pane->s_list; | ||
| 863 | register XMSelect *s_ptr; | ||
| 864 | |||
| 865 | /* | ||
| 866 | * First clear the pane. | ||
| 867 | */ | ||
| 868 | XClearWindow(display, pane->window); | ||
| 869 | if (!pane->activated) { | ||
| 870 | XFillRectangle(display, | ||
| 871 | pane->window, | ||
| 872 | menu->inverse_select_GC, | ||
| 873 | pane->label_x - menu->p_fnt_pad, | ||
| 874 | pane->label_uy - menu->p_fnt_info->max_bounds.ascent - menu->p_fnt_pad, | ||
| 875 | pane->label_width + (menu->p_fnt_pad << 1), | ||
| 876 | menu->flag_height); | ||
| 877 | |||
| 878 | XFillRectangle(display, | ||
| 879 | pane->window, | ||
| 880 | menu->inverse_select_GC, | ||
| 881 | pane->label_x - menu->p_fnt_pad, | ||
| 882 | pane->label_ly - menu->p_fnt_info->max_bounds.ascent - menu->p_fnt_pad, | ||
| 883 | pane->label_width + (menu->p_fnt_pad << 1), | ||
| 884 | menu->flag_height); | ||
| 885 | } | ||
| 886 | if (!pane->active) { | ||
| 887 | XDrawString(display, | ||
| 888 | pane->window, | ||
| 889 | menu->inact_GC, | ||
| 890 | pane->label_x, pane->label_uy, | ||
| 891 | pane->label, pane->label_length); | ||
| 892 | XDrawString(display, | ||
| 893 | pane->window, | ||
| 894 | menu->inact_GC, | ||
| 895 | pane->label_x, pane->label_ly, | ||
| 896 | pane->label, pane->label_length); | ||
| 897 | } | ||
| 898 | else { | ||
| 899 | XDrawString(display, | ||
| 900 | pane->window, | ||
| 901 | menu->pane_GC, | ||
| 902 | pane->label_x, pane->label_uy, | ||
| 903 | pane->label, pane->label_length); | ||
| 904 | XDrawString(display, | ||
| 905 | pane->window, | ||
| 906 | menu->pane_GC, | ||
| 907 | pane->label_x, pane->label_ly, | ||
| 908 | pane->label, pane->label_length); | ||
| 909 | |||
| 910 | /* | ||
| 911 | * Finally refresh each selection if the pane is activated. | ||
| 912 | */ | ||
| 913 | if (pane->activated) { | ||
| 914 | for (s_ptr = s_list->next; s_ptr != s_list; s_ptr = s_ptr->next) | ||
| 915 | _XMRefreshSelection(display, menu, s_ptr); | ||
| 916 | } | ||
| 917 | } | ||
| 918 | } | ||
| 919 | |||
| 920 | |||
| 921 | |||
| 922 | |||
| 923 | /* | ||
| 924 | * _XMRefreshSelection - Internal subroutine that refreshes | ||
| 925 | * a single selection window. | ||
| 926 | */ | ||
| 927 | _XMRefreshSelection(display, menu, select) | ||
| 928 | register Display *display; | ||
| 929 | register XMenu *menu; | ||
| 930 | register XMSelect *select; | ||
| 931 | { | ||
| 932 | register int width = select->window_w; | ||
| 933 | register int height = select->window_h; | ||
| 934 | register int bdr_width = menu->s_bdr_width; | ||
| 935 | |||
| 936 | if (select->type == SEPARATOR) { | ||
| 937 | XDrawLine(display, | ||
| 938 | select->parent_p->window, | ||
| 939 | menu->normal_select_GC, | ||
| 940 | select->window_x, | ||
| 941 | select->window_y + height / 2, | ||
| 942 | select->window_x + width, | ||
| 943 | select->window_y + height / 2); | ||
| 944 | } | ||
| 945 | else if (select->activated) { | ||
| 946 | if (menu->menu_mode == INVERT) { | ||
| 947 | XFillRectangle(display, | ||
| 948 | select->parent_p->window, | ||
| 949 | menu->normal_select_GC, | ||
| 950 | select->window_x, select->window_y, | ||
| 951 | width, height); | ||
| 952 | XDrawString(display, | ||
| 953 | select->parent_p->window, | ||
| 954 | menu->inverse_select_GC, | ||
| 955 | select->label_x, | ||
| 956 | select->label_y, | ||
| 957 | select->label, select->label_length); | ||
| 958 | } | ||
| 959 | else { | ||
| 960 | /* | ||
| 961 | * Using BOX mode. | ||
| 962 | * Since most drawing routines with arbitrary width lines | ||
| 963 | * are slow compared to raster-ops lets use a raster-op to | ||
| 964 | * draw the boxes. | ||
| 965 | */ | ||
| 966 | |||
| 967 | XDrawRectangle(display, | ||
| 968 | select->parent_p->window, | ||
| 969 | menu->normal_select_GC, | ||
| 970 | select->window_x + (bdr_width >> 1), | ||
| 971 | select->window_y + (bdr_width >> 1 ), | ||
| 972 | width - bdr_width, | ||
| 973 | height - bdr_width); | ||
| 974 | XDrawString(display, | ||
| 975 | select->parent_p->window, | ||
| 976 | menu->normal_select_GC, | ||
| 977 | select->label_x, | ||
| 978 | select->label_y, | ||
| 979 | select->label, select->label_length); | ||
| 980 | } | ||
| 981 | } | ||
| 982 | else { | ||
| 983 | XClearArea(display, | ||
| 984 | select->parent_p->window, | ||
| 985 | select->window_x, select->window_y, | ||
| 986 | width, height, | ||
| 987 | False); | ||
| 988 | if (select->active) { | ||
| 989 | XDrawString(display, | ||
| 990 | select->parent_p->window, | ||
| 991 | menu->normal_select_GC, | ||
| 992 | select->label_x, | ||
| 993 | select->label_y, | ||
| 994 | select->label, select->label_length); | ||
| 995 | } | ||
| 996 | else { | ||
| 997 | XDrawString(display, | ||
| 998 | select->parent_p->window, | ||
| 999 | menu->inact_GC, | ||
| 1000 | select->label_x, | ||
| 1001 | select->label_y, | ||
| 1002 | select->label, select->label_length); | ||
| 1003 | } | ||
| 1004 | } | ||
| 1005 | } | ||
| 1006 | |||
diff --git a/oldXMenu/Locate.c b/oldXMenu/Locate.c new file mode 100644 index 00000000000..1e02807de96 --- /dev/null +++ b/oldXMenu/Locate.c | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/Locate.c,v 1.1 1992/04/11 22:10:20 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuLocate - Return data necessary to position and locate | ||
| 10 | * a menu on the screen. | ||
| 11 | * | ||
| 12 | * Author: Tony Della Fera, DEC | ||
| 13 | * January 11, 1985 | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "XMenuInt.h" | ||
| 18 | |||
| 19 | int | ||
| 20 | XMenuLocate(display, menu, p_num, s_num, x_pos, y_pos, ul_x, ul_y, width, height) | ||
| 21 | register Display *display; /* Previously opened display. */ | ||
| 22 | register XMenu *menu; /* Menu object being located. */ | ||
| 23 | int p_num; /* Active pane number. */ | ||
| 24 | int s_num; /* Active selection number. */ | ||
| 25 | int x_pos; /* X coordinate of mouse active position. */ | ||
| 26 | int y_pos; /* Y coordinate of mouse active position. */ | ||
| 27 | int *ul_x; /* Returned upper left menu X coordinate. */ | ||
| 28 | int *ul_y; /* Returned upper left menu Y coordinate. */ | ||
| 29 | int *width; /* Returned menu width. */ | ||
| 30 | int *height; /* Returned menu height. */ | ||
| 31 | { | ||
| 32 | register XMPane *p_ptr; /* XMPane pointer. */ | ||
| 33 | register XMSelect *s_ptr; /* XMSelect pointer. */ | ||
| 34 | |||
| 35 | /* | ||
| 36 | * Are the position arguments positive? | ||
| 37 | */ | ||
| 38 | if ((x_pos <= 0) || (y_pos <= 0)) { | ||
| 39 | _XMErrorCode = XME_ARG_BOUNDS; | ||
| 40 | return(XM_FAILURE); | ||
| 41 | } | ||
| 42 | |||
| 43 | /* | ||
| 44 | * Find the right pane. | ||
| 45 | */ | ||
| 46 | p_ptr = _XMGetPanePtr(menu, p_num); | ||
| 47 | if (p_ptr == NULL) return(XM_FAILURE); | ||
| 48 | |||
| 49 | /* | ||
| 50 | * Find the right selection. | ||
| 51 | */ | ||
| 52 | s_ptr = _XMGetSelectionPtr(p_ptr, s_num); | ||
| 53 | |||
| 54 | /* | ||
| 55 | * Check to see that the menu's dependencies have been | ||
| 56 | * recomputed and are up to date. If not, do it now. | ||
| 57 | */ | ||
| 58 | if (menu->recompute) XMenuRecompute(display, menu); | ||
| 59 | |||
| 60 | /* | ||
| 61 | * Compute the new menu origin such that the active point lies | ||
| 62 | * in the center of the desired active pane and selection. | ||
| 63 | * This sets the values of ul_x and ul_y. | ||
| 64 | */ | ||
| 65 | _XMTransToOrigin(display, menu, p_ptr, s_ptr, x_pos, y_pos, ul_x, ul_y); | ||
| 66 | |||
| 67 | /* | ||
| 68 | * Set remaining return argument values. | ||
| 69 | */ | ||
| 70 | *width = menu->width; | ||
| 71 | *height = menu->height; | ||
| 72 | |||
| 73 | /* | ||
| 74 | * Return successfully. | ||
| 75 | */ | ||
| 76 | _XMErrorCode = XME_NO_ERROR; | ||
| 77 | return(XM_SUCCESS); | ||
| 78 | } | ||
diff --git a/oldXMenu/Makefile.in b/oldXMenu/Makefile.in new file mode 100644 index 00000000000..e20a583514a --- /dev/null +++ b/oldXMenu/Makefile.in | |||
| @@ -0,0 +1,109 @@ | |||
| 1 | srcdir=@srcdir@ | ||
| 2 | VPATH=@srcdir@ | ||
| 3 | C_SWITCH_X_SITE=@C_SWITCH_X_SITE@ | ||
| 4 | |||
| 5 | EXTRA=insque.o | ||
| 6 | CC=@CC@ | ||
| 7 | CFLAGS=@CFLAGS@ | ||
| 8 | CPP=@CPP@ | ||
| 9 | LN_S=@LN_S@ | ||
| 10 | AS = as | ||
| 11 | LD = ld | ||
| 12 | TAGS = etags | ||
| 13 | RM = rm -f | ||
| 14 | MV = mv | ||
| 15 | RANLIB = ranlib | ||
| 16 | # Solaris 2.1 ar doesn't accept the 'l' option. | ||
| 17 | AR = ar cq | ||
| 18 | LS = ls | ||
| 19 | LINTOPTS = -axz | ||
| 20 | LINTLIBFLAG = -C | ||
| 21 | MAKE = make | ||
| 22 | STD_DEFINES = | ||
| 23 | CDEBUGFLAGS = -O | ||
| 24 | RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \ | ||
| 25 | tags TAGS make.log | ||
| 26 | |||
| 27 | OBJS = Activate.o \ | ||
| 28 | AddPane.o \ | ||
| 29 | AddSel.o \ | ||
| 30 | ChgPane.o \ | ||
| 31 | ChgSel.o \ | ||
| 32 | Create.o \ | ||
| 33 | DelPane.o \ | ||
| 34 | DelSel.o \ | ||
| 35 | Destroy.o \ | ||
| 36 | Error.o \ | ||
| 37 | EvHand.o \ | ||
| 38 | FindPane.o \ | ||
| 39 | FindSel.o \ | ||
| 40 | InsPane.o \ | ||
| 41 | InsSel.o \ | ||
| 42 | Internal.o \ | ||
| 43 | Locate.o \ | ||
| 44 | Post.o \ | ||
| 45 | Recomp.o \ | ||
| 46 | SetAEQ.o \ | ||
| 47 | SetFrz.o \ | ||
| 48 | SetPane.o \ | ||
| 49 | SetSel.o \ | ||
| 50 | XDelAssoc.o XLookAssoc.o XCrAssoc.o XDestAssoc.o XMakeAssoc.o | ||
| 51 | |||
| 52 | all:: libXMenu11.a | ||
| 53 | |||
| 54 | ALL_CFLAGS=$(C_SWITCH_SITE) $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ | ||
| 55 | $(C_SWITCH_X_SITE) $(C_SWITCH_X_SYSTEM) $(C_SWITCH_X_MACHINE) \ | ||
| 56 | $(CPPFLAGS) $(CFLAGS) -DEMACS_BITMAP_FILES \ | ||
| 57 | -I../src -I${srcdir} -I${srcdir}/../src | ||
| 58 | |||
| 59 | .c.o: | ||
| 60 | $(CC) -c ${ALL_CFLAGS} $< | ||
| 61 | |||
| 62 | libXMenu11.a: $(OBJS) $(EXTRA) | ||
| 63 | $(RM) $@ | ||
| 64 | $(AR) $@ $(OBJS) $(EXTRA) | ||
| 65 | @echo Do not be alarmed if the following ranlib command | ||
| 66 | @echo fails due to the absence of a ranlib program on your system. | ||
| 67 | -$(RANLIB) $@ || true | ||
| 68 | #If running ranlib fails, probably there is none. | ||
| 69 | #That's ok. So don't stop the build. | ||
| 70 | |||
| 71 | Activate.o: Activate.c XMenuInt.h XMenu.h X10.h | ||
| 72 | AddPane.o: AddPane.c XMenuInt.h XMenu.h X10.h | ||
| 73 | AddSel.o: AddSel.c XMenuInt.h XMenu.h X10.h | ||
| 74 | ChgPane.o: ChgPane.c XMenuInt.h XMenu.h X10.h | ||
| 75 | ChgSel.o: ChgSel.c XMenuInt.h XMenu.h X10.h | ||
| 76 | Create.o: Create.c XMenuInt.h XMenu.h X10.h | ||
| 77 | DelPane.o: DelPane.c XMenuInt.h XMenu.h X10.h | ||
| 78 | DelSel.o: DelSel.c XMenuInt.h XMenu.h X10.h | ||
| 79 | Destroy.o: Destroy.c XMenuInt.h XMenu.h X10.h | ||
| 80 | Error.o: Error.c XMenuInt.h XMenu.h X10.h | ||
| 81 | EvHand.o: EvHand.c XMenuInt.h XMenu.h X10.h | ||
| 82 | FindPane.o: FindPane.c XMenuInt.h XMenu.h X10.h | ||
| 83 | FindSel.o: FindSel.c XMenuInt.h XMenu.h X10.h | ||
| 84 | InsPane.o: InsPane.c XMenuInt.h XMenu.h X10.h | ||
| 85 | InsSel.o: InsSel.c XMenuInt.h XMenu.h X10.h | ||
| 86 | Internal.o: Internal.c XMenuInt.h XMenu.h X10.h | ||
| 87 | Locate.o: Locate.c XMenuInt.h XMenu.h X10.h | ||
| 88 | Post.o: Post.c XMenuInt.h XMenu.h X10.h | ||
| 89 | Recomp.o: Recomp.c XMenuInt.h XMenu.h X10.h | ||
| 90 | SetAEQ.o: SetAEQ.c XMenuInt.h XMenu.h X10.h | ||
| 91 | SetFrz.o: SetFrz.c XMenuInt.h XMenu.h X10.h | ||
| 92 | SetPane.o: SetPane.c XMenuInt.h XMenu.h X10.h | ||
| 93 | SetSel.o: SetSel.c XMenuInt.h XMenu.h X10.h | ||
| 94 | XDelAssoc.o: XDelAssoc.c X10.h | ||
| 95 | XLookAssoc.o: XLookAssoc.c X10.h | ||
| 96 | XCrAssoc.o: XCrAssoc.c X10.h | ||
| 97 | XDestAssoc.o: XDestAssoc.c X10.h | ||
| 98 | XMakeAssoc.o: XMakeAssoc.c X10.h | ||
| 99 | insque.o: insque.c | ||
| 100 | |||
| 101 | FRC.mostlyclean: | ||
| 102 | mostlyclean: FRC.mostlyclean | ||
| 103 | rm -f libXMenu11.a ${OBJS} ${EXTRA} | ||
| 104 | clean: mostlyclean | ||
| 105 | distclean: clean | ||
| 106 | maintainer-clean: distclean | ||
| 107 | |||
| 108 | tags:: | ||
| 109 | $(TAGS) -t *.[ch] | ||
diff --git a/oldXMenu/Post.c b/oldXMenu/Post.c new file mode 100644 index 00000000000..8b0a0803811 --- /dev/null +++ b/oldXMenu/Post.c | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/Post.c,v 1.1 1992/04/11 22:10:20 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuPost - Maps a given menu to the display and activates | ||
| 10 | * the menu for user selection. The user is allowed to | ||
| 11 | * specify the mouse button event mask that will be used | ||
| 12 | * to identify a selection request. When a selection | ||
| 13 | * request is received (i.e., when the specified mouse | ||
| 14 | * event occurs) the data returned will be either the | ||
| 15 | * data associated with the particular selection active | ||
| 16 | * at the time of the selection request or NULL if no | ||
| 17 | * selection was active. A menu selection is shown to | ||
| 18 | * be active by placing a highlight box around the | ||
| 19 | * selection as the mouse cursor enters its active | ||
| 20 | * region. Inactive selections will not be highlighted. | ||
| 21 | * As the mouse cursor moved from one menu pane | ||
| 22 | * to another menu pane the pane being entered is raised | ||
| 23 | * and activated and the pane being left is deactivated. | ||
| 24 | * If an error occurs NULL will be returned with the | ||
| 25 | * p_num set to POST_ERROR, s_num set to | ||
| 26 | * NO_SELECTION and _XMErrorCode set to an | ||
| 27 | * appropriate value. | ||
| 28 | * Every time the routine returns successfully the | ||
| 29 | * p_num and s_num indices will be set to indicate | ||
| 30 | * the currently active pane and/or selection. If the | ||
| 31 | * mouse was not in a selection window at the time | ||
| 32 | * s_num will be set to NO_SELECTION. | ||
| 33 | * | ||
| 34 | * Author: Tony Della Fera, DEC | ||
| 35 | * August, 1984 | ||
| 36 | * | ||
| 37 | */ | ||
| 38 | |||
| 39 | #include "XMenuInt.h" | ||
| 40 | |||
| 41 | char * | ||
| 42 | XMenuPost(display, menu, p_num, s_num, x_pos, y_pos, event_mask) | ||
| 43 | register Display *display; /* Previously opened display. */ | ||
| 44 | register XMenu *menu; /* Menu to post. */ | ||
| 45 | register int *p_num; /* Pane number selected. */ | ||
| 46 | register int *s_num; /* Selection number selected. */ | ||
| 47 | register int x_pos; /* X coordinate of menu position. */ | ||
| 48 | register int y_pos; /* Y coordinate of menu position. */ | ||
| 49 | int event_mask; /* Mouse button event mask. */ | ||
| 50 | { | ||
| 51 | register int stat; /* Routine call return status. */ | ||
| 52 | char *data; /* Return data. */ | ||
| 53 | |||
| 54 | /* | ||
| 55 | * Set up initial pane and selection assumptions. | ||
| 56 | */ | ||
| 57 | |||
| 58 | /* | ||
| 59 | * Make the procedure call. | ||
| 60 | */ | ||
| 61 | stat = XMenuActivate( | ||
| 62 | display, | ||
| 63 | menu, | ||
| 64 | p_num, s_num, | ||
| 65 | x_pos, y_pos, | ||
| 66 | event_mask, | ||
| 67 | &data); | ||
| 68 | |||
| 69 | /* | ||
| 70 | * Check the return value and return accordingly. | ||
| 71 | */ | ||
| 72 | switch (stat) { | ||
| 73 | case XM_FAILURE: | ||
| 74 | *p_num = POST_ERROR; | ||
| 75 | *s_num = NO_SELECTION; | ||
| 76 | return(NULL); | ||
| 77 | case XM_NO_SELECT: | ||
| 78 | case XM_IA_SELECT: | ||
| 79 | *s_num = NO_SELECTION; | ||
| 80 | return(NULL); | ||
| 81 | case XM_SUCCESS: | ||
| 82 | default: | ||
| 83 | return(data); | ||
| 84 | } | ||
| 85 | } | ||
diff --git a/oldXMenu/README b/oldXMenu/README new file mode 100644 index 00000000000..79b4250633d --- /dev/null +++ b/oldXMenu/README | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | This directory contains the source code for the X11R2 XMenu library. | ||
| 2 | |||
| 3 | As of Release 2 of the X Window System, Version 11 from MIT, the XMenu | ||
| 4 | library no longer supported. It is not used in any software supplied | ||
| 5 | by MIT and its use is not encouraged. | ||
| 6 | |||
diff --git a/oldXMenu/Recomp.c b/oldXMenu/Recomp.c new file mode 100644 index 00000000000..c433cd550fd --- /dev/null +++ b/oldXMenu/Recomp.c | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/Recomp.c,v 1.1 1992/04/11 22:10:20 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuRecompute - Recompute XMenu object dependencies. | ||
| 10 | * | ||
| 11 | * Author: Tony Della Fera, DEC | ||
| 12 | * September, 1985 | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include "XMenuInt.h" | ||
| 17 | |||
| 18 | int | ||
| 19 | XMenuRecompute(display, menu) | ||
| 20 | Display *display; | ||
| 21 | register XMenu *menu; /* Menu object to be recomputed. */ | ||
| 22 | { | ||
| 23 | register XMPane *p_ptr; /* Pane pointer. */ | ||
| 24 | register XMSelect *s_ptr; /* Selection pointer. */ | ||
| 25 | |||
| 26 | register int p_num; /* Pane serial number. */ | ||
| 27 | register int s_num; /* Selection serial number. */ | ||
| 28 | |||
| 29 | /* | ||
| 30 | * If there are no panes in the menu then return failure | ||
| 31 | * because the menu is not initialized. | ||
| 32 | */ | ||
| 33 | if (menu->p_count == 0) { | ||
| 34 | _XMErrorCode = XME_NOT_INIT; | ||
| 35 | return(XM_FAILURE); | ||
| 36 | } | ||
| 37 | |||
| 38 | /* | ||
| 39 | * Recompute menu wide global values: pane window size, | ||
| 40 | * selection size and maximum selection count. | ||
| 41 | */ | ||
| 42 | _XMRecomputeGlobals(display, menu); | ||
| 43 | |||
| 44 | /* | ||
| 45 | * For each pane in the menu... | ||
| 46 | */ | ||
| 47 | |||
| 48 | p_num = 0; | ||
| 49 | for ( | ||
| 50 | p_ptr = menu->p_list->next; | ||
| 51 | p_ptr != menu->p_list; | ||
| 52 | p_ptr = p_ptr->next | ||
| 53 | ){ | ||
| 54 | /* | ||
| 55 | * Recompute pane dependencies. | ||
| 56 | */ | ||
| 57 | if (_XMRecomputePane(display, menu, p_ptr, p_num) == _FAILURE) { | ||
| 58 | return(XM_FAILURE); | ||
| 59 | } | ||
| 60 | p_num++; | ||
| 61 | |||
| 62 | /* | ||
| 63 | * For each selection in the pane... | ||
| 64 | */ | ||
| 65 | s_num = 0; | ||
| 66 | for ( | ||
| 67 | s_ptr = p_ptr->s_list->next; | ||
| 68 | s_ptr != p_ptr->s_list; | ||
| 69 | s_ptr = s_ptr->next | ||
| 70 | ) { | ||
| 71 | /* | ||
| 72 | * Recompute selection dependencies. | ||
| 73 | */ | ||
| 74 | if (_XMRecomputeSelection(display, menu, s_ptr, s_num) == _FAILURE) { | ||
| 75 | return(XM_FAILURE); | ||
| 76 | } | ||
| 77 | s_num++; | ||
| 78 | } | ||
| 79 | } | ||
| 80 | |||
| 81 | /* | ||
| 82 | * Recompute menu size. | ||
| 83 | */ | ||
| 84 | if (menu->menu_style == CENTER) { | ||
| 85 | menu->width = menu->p_width + (menu->p_bdr_width << 1); | ||
| 86 | } | ||
| 87 | else { | ||
| 88 | menu->width = menu->p_width + (menu->p_bdr_width << 1) + | ||
| 89 | ((menu->p_count - 1) * menu->p_x_off); | ||
| 90 | } | ||
| 91 | menu->height = menu->p_height + (menu->p_bdr_width << 1) + | ||
| 92 | ((menu->p_count - 1) * menu->p_y_off); | ||
| 93 | |||
| 94 | /* | ||
| 95 | * Reset the recompute flag. | ||
| 96 | */ | ||
| 97 | menu->recompute = 0; | ||
| 98 | |||
| 99 | /* | ||
| 100 | * Return successfully. | ||
| 101 | */ | ||
| 102 | _XMErrorCode = XME_NO_ERROR; | ||
| 103 | return(XM_SUCCESS); | ||
| 104 | } | ||
diff --git a/oldXMenu/SetAEQ.c b/oldXMenu/SetAEQ.c new file mode 100644 index 00000000000..7da7c118229 --- /dev/null +++ b/oldXMenu/SetAEQ.c | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/SetAEQ.c,v 1.1 1992/04/11 22:10:20 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuSetAEQ - Set Asynchronous event queuing mode. | ||
| 10 | * When enabled asynchronous events will be queue while | ||
| 11 | * a menu is being displayed and restored to the X | ||
| 12 | * event queue when the menu is taken down. | ||
| 13 | * | ||
| 14 | * Author: Tony Della Fera, DEC | ||
| 15 | * March 12, 1986 | ||
| 16 | * | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include "XMenuInt.h" | ||
| 20 | |||
| 21 | XMenuSetAEQ(menu, aeq) | ||
| 22 | register XMenu *menu; /* Menu object to be modified. */ | ||
| 23 | register int aeq; /* AEQ mode? */ | ||
| 24 | { | ||
| 25 | /* | ||
| 26 | * Set the AEQ mode switch. | ||
| 27 | */ | ||
| 28 | menu->aeq = aeq; | ||
| 29 | } | ||
diff --git a/oldXMenu/SetFrz.c b/oldXMenu/SetFrz.c new file mode 100644 index 00000000000..0b5cb270f45 --- /dev/null +++ b/oldXMenu/SetFrz.c | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/SetFrz.c,v 1.1 1992/04/11 22:10:21 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuSetFreeze - Forcibly set the menu freeze mode switch | ||
| 10 | * overriding the Xdefaults setting. | ||
| 11 | * This is necessary in some situations. | ||
| 12 | * | ||
| 13 | * Author: Tony Della Fera, DEC | ||
| 14 | * January 29, 1986 | ||
| 15 | * | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "XMenuInt.h" | ||
| 19 | |||
| 20 | XMenuSetFreeze(menu, freeze) | ||
| 21 | register XMenu *menu; /* Menu object to be modified. */ | ||
| 22 | register int freeze; /* Freeze mode? */ | ||
| 23 | { | ||
| 24 | /* | ||
| 25 | * Set the freeze mode switch. | ||
| 26 | */ | ||
| 27 | menu->freeze = freeze; | ||
| 28 | } | ||
diff --git a/oldXMenu/SetPane.c b/oldXMenu/SetPane.c new file mode 100644 index 00000000000..cdd9e37626a --- /dev/null +++ b/oldXMenu/SetPane.c | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/SetPane.c,v 1.1 1992/04/11 22:10:21 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuSetPane - Set a menu pane to be active or inactive. | ||
| 10 | * | ||
| 11 | * Author: Tony Della Fera, DEC | ||
| 12 | * August, 1985 | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include "XMenuInt.h" | ||
| 17 | |||
| 18 | int | ||
| 19 | XMenuSetPane(menu, p_num, active) | ||
| 20 | register XMenu *menu; /* Menu object to be modified. */ | ||
| 21 | register int p_num; /* Pane number to be modified. */ | ||
| 22 | register int active; /* Make selection active? */ | ||
| 23 | { | ||
| 24 | register XMPane *p_ptr; /* XMPane pointer. */ | ||
| 25 | |||
| 26 | /* | ||
| 27 | * Find the right pane. | ||
| 28 | */ | ||
| 29 | p_ptr = _XMGetPanePtr(menu, p_num); | ||
| 30 | if (p_ptr == NULL) return(XM_FAILURE); | ||
| 31 | |||
| 32 | /* | ||
| 33 | * Set its active switch. | ||
| 34 | */ | ||
| 35 | p_ptr->active = active; | ||
| 36 | if (p_ptr->active == False) p_ptr->activated = False; | ||
| 37 | |||
| 38 | /* | ||
| 39 | * Return the pane number just set. | ||
| 40 | */ | ||
| 41 | _XMErrorCode = XME_NO_ERROR; | ||
| 42 | return(p_num); | ||
| 43 | } | ||
diff --git a/oldXMenu/SetSel.c b/oldXMenu/SetSel.c new file mode 100644 index 00000000000..0db2c8eb6bb --- /dev/null +++ b/oldXMenu/SetSel.c | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/SetSel.c,v 1.1 1992/04/11 22:10:21 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenuSetSelection - Set a menu selection to be active or inactive. | ||
| 10 | * | ||
| 11 | * Author: Tony Della Fera, DEC | ||
| 12 | * August, 1985 | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include "XMenuInt.h" | ||
| 17 | |||
| 18 | int | ||
| 19 | XMenuSetSelection(menu, p_num, s_num, active) | ||
| 20 | register XMenu *menu; /* Menu object to be modified. */ | ||
| 21 | register int p_num; /* Pane number to be modified. */ | ||
| 22 | register int s_num; /* Selection number to modified. */ | ||
| 23 | int active; /* Make selection active? */ | ||
| 24 | { | ||
| 25 | register XMPane *p_ptr; /* XMPane pointer. */ | ||
| 26 | register XMSelect *s_ptr; /* XMSelect pointer. */ | ||
| 27 | |||
| 28 | /* | ||
| 29 | * Find the right pane. | ||
| 30 | */ | ||
| 31 | p_ptr = _XMGetPanePtr(menu, p_num); | ||
| 32 | if (p_ptr == NULL) return(XM_FAILURE); | ||
| 33 | |||
| 34 | /* | ||
| 35 | * Find the right selection. | ||
| 36 | */ | ||
| 37 | s_ptr = _XMGetSelectionPtr(p_ptr, s_num); | ||
| 38 | if (s_ptr == NULL) return(XM_FAILURE); | ||
| 39 | |||
| 40 | /* | ||
| 41 | * Set its active switch. | ||
| 42 | */ | ||
| 43 | s_ptr->active = active; | ||
| 44 | |||
| 45 | /* | ||
| 46 | * Return the selection number just set. | ||
| 47 | */ | ||
| 48 | _XMErrorCode = XME_NO_ERROR; | ||
| 49 | return(s_num); | ||
| 50 | } | ||
diff --git a/oldXMenu/X10.h b/oldXMenu/X10.h new file mode 100644 index 00000000000..4a983feac20 --- /dev/null +++ b/oldXMenu/X10.h | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/X10.h,v 1.1 1992/04/11 22:10:21 jimb Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright 1985, 1986, 1987 by the Massachusetts Institute of Technology | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software and its | ||
| 6 | * documentation for any purpose and without fee is hereby granted, provided | ||
| 7 | * that the above copyright notice appear in all copies and that both that | ||
| 8 | * copyright notice and this permission notice appear in supporting | ||
| 9 | * documentation, and that the name of M.I.T. not be used in advertising | ||
| 10 | * or publicity pertaining to distribution of the software without specific, | ||
| 11 | * written prior permission. M.I.T. makes no representations about the | ||
| 12 | * suitability of this software for any purpose. It is provided "as is" | ||
| 13 | * without express or implied warranty. | ||
| 14 | * | ||
| 15 | * The X Window System is a Trademark of MIT. | ||
| 16 | * | ||
| 17 | */ | ||
| 18 | |||
| 19 | |||
| 20 | /* | ||
| 21 | * X10.h - Header definition and support file for the C subroutine | ||
| 22 | * interface library for V10 support routines. | ||
| 23 | */ | ||
| 24 | #ifndef _X10_H_ | ||
| 25 | #define _X10_H_ | ||
| 26 | |||
| 27 | /* Used in XDraw and XDrawFilled */ | ||
| 28 | |||
| 29 | typedef struct { | ||
| 30 | short x, y; | ||
| 31 | unsigned short flags; | ||
| 32 | } Vertex; | ||
| 33 | |||
| 34 | /* The meanings of the flag bits. If the bit is 1 the predicate is true */ | ||
| 35 | |||
| 36 | #define VertexRelative 0x0001 /* else absolute */ | ||
| 37 | #define VertexDontDraw 0x0002 /* else draw */ | ||
| 38 | #define VertexCurved 0x0004 /* else straight */ | ||
| 39 | #define VertexStartClosed 0x0008 /* else not */ | ||
| 40 | #define VertexEndClosed 0x0010 /* else not */ | ||
| 41 | /*#define VertexDrawLastPoint 0x0020 */ /* else don't */ | ||
| 42 | |||
| 43 | /* | ||
| 44 | The VertexDrawLastPoint option has not been implemented in XDraw and | ||
| 45 | XDrawFilled so it shouldn't be defined. | ||
| 46 | */ | ||
| 47 | |||
| 48 | /* | ||
| 49 | * XAssoc - Associations used in the XAssocTable data structure. The | ||
| 50 | * associations are used as circular queue entries in the association table | ||
| 51 | * which is contains an array of circular queues (buckets). | ||
| 52 | */ | ||
| 53 | typedef struct _XAssoc { | ||
| 54 | struct _XAssoc *next; /* Next object in this bucket. */ | ||
| 55 | struct _XAssoc *prev; /* Previous obejct in this bucket. */ | ||
| 56 | Display *display; /* Display which owns the id. */ | ||
| 57 | XID x_id; /* X Window System id. */ | ||
| 58 | char *data; /* Pointer to untyped memory. */ | ||
| 59 | } XAssoc; | ||
| 60 | |||
| 61 | /* | ||
| 62 | * XAssocTable - X Window System id to data structure pointer association | ||
| 63 | * table. An XAssocTable is a hash table whose buckets are circular | ||
| 64 | * queues of XAssoc's. The XAssocTable is constructed from an array of | ||
| 65 | * XAssoc's which are the circular queue headers (bucket headers). | ||
| 66 | * An XAssocTable consists an XAssoc pointer that points to the first | ||
| 67 | * bucket in the bucket array and an integer that indicates the number | ||
| 68 | * of buckets in the array. | ||
| 69 | */ | ||
| 70 | typedef struct { | ||
| 71 | XAssoc *buckets; /* Pointer to first bucket in bucket array.*/ | ||
| 72 | int size; /* Table size (number of buckets). */ | ||
| 73 | } XAssocTable; | ||
| 74 | |||
| 75 | XAssocTable *XCreateAssocTable(); | ||
| 76 | char *XLookUpAssoc(); | ||
| 77 | |||
| 78 | #endif /* _X10_H_ */ | ||
diff --git a/oldXMenu/XCrAssoc.c b/oldXMenu/XCrAssoc.c new file mode 100644 index 00000000000..864ed9d4f1f --- /dev/null +++ b/oldXMenu/XCrAssoc.c | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | /* $XConsortium: XCrAssoc.c,v 10.17 91/01/06 12:04:57 rws Exp $ */ | ||
| 2 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 3 | |||
| 4 | /* | ||
| 5 | Permission to use, copy, modify, distribute, and sell this software and its | ||
| 6 | documentation for any purpose is hereby granted without fee, provided that | ||
| 7 | the above copyright notice appear in all copies and that both that | ||
| 8 | copyright notice and this permission notice appear in supporting | ||
| 9 | documentation, and that the name of M.I.T. not be used in advertising or | ||
| 10 | publicity pertaining to distribution of the software without specific, | ||
| 11 | written prior permission. M.I.T. makes no representations about the | ||
| 12 | suitability of this software for any purpose. It is provided "as is" | ||
| 13 | without express or implied warranty. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <config.h> | ||
| 17 | #include <X11/Xlib.h> | ||
| 18 | #include <errno.h> | ||
| 19 | #include "X10.h" | ||
| 20 | |||
| 21 | #ifndef NULL | ||
| 22 | #define NULL 0 | ||
| 23 | #endif | ||
| 24 | |||
| 25 | extern int errno; | ||
| 26 | |||
| 27 | /* | ||
| 28 | * XCreateAssocTable - Create an XAssocTable. The size argument should be | ||
| 29 | * a power of two for efficiency reasons. Some size suggestions: use 32 | ||
| 30 | * buckets per 100 objects; a reasonable maximum number of object per | ||
| 31 | * buckets is 8. If there is an error creating the XAssocTable, a NULL | ||
| 32 | * pointer is returned. | ||
| 33 | */ | ||
| 34 | XAssocTable *XCreateAssocTable(size) | ||
| 35 | register int size; /* Desired size of the table. */ | ||
| 36 | { | ||
| 37 | register XAssocTable *table; /* XAssocTable to be initialized. */ | ||
| 38 | register XAssoc *buckets; /* Pointer to the first bucket in */ | ||
| 39 | /* the bucket array. */ | ||
| 40 | |||
| 41 | /* Malloc the XAssocTable. */ | ||
| 42 | if ((table = (XAssocTable *)malloc(sizeof(XAssocTable))) == NULL) { | ||
| 43 | /* malloc call failed! */ | ||
| 44 | errno = ENOMEM; | ||
| 45 | return(NULL); | ||
| 46 | } | ||
| 47 | |||
| 48 | /* calloc the buckets (actually just their headers). */ | ||
| 49 | buckets = (XAssoc *)calloc((unsigned)size, (unsigned)sizeof(XAssoc)); | ||
| 50 | if (buckets == NULL) { | ||
| 51 | /* calloc call failed! */ | ||
| 52 | errno = ENOMEM; | ||
| 53 | return(NULL); | ||
| 54 | } | ||
| 55 | |||
| 56 | /* Insert table data into the XAssocTable structure. */ | ||
| 57 | table->buckets = buckets; | ||
| 58 | table->size = size; | ||
| 59 | |||
| 60 | while (--size >= 0) { | ||
| 61 | /* Initialize each bucket. */ | ||
| 62 | buckets->prev = buckets; | ||
| 63 | buckets->next = buckets; | ||
| 64 | buckets++; | ||
| 65 | } | ||
| 66 | |||
| 67 | return(table); | ||
| 68 | } | ||
diff --git a/oldXMenu/XDelAssoc.c b/oldXMenu/XDelAssoc.c new file mode 100644 index 00000000000..df3bee6ee90 --- /dev/null +++ b/oldXMenu/XDelAssoc.c | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | /* $XConsortium: XDelAssoc.c,v 10.19 91/01/06 12:06:39 rws Exp $ */ | ||
| 2 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 3 | |||
| 4 | /* | ||
| 5 | Permission to use, copy, modify, distribute, and sell this software and its | ||
| 6 | documentation for any purpose is hereby granted without fee, provided that | ||
| 7 | the above copyright notice appear in all copies and that both that | ||
| 8 | copyright notice and this permission notice appear in supporting | ||
| 9 | documentation, and that the name of M.I.T. not be used in advertising or | ||
| 10 | publicity pertaining to distribution of the software without specific, | ||
| 11 | written prior permission. M.I.T. makes no representations about the | ||
| 12 | suitability of this software for any purpose. It is provided "as is" | ||
| 13 | without express or implied warranty. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <X11/Xlib.h> | ||
| 17 | #include "X10.h" | ||
| 18 | void emacs_remque(); | ||
| 19 | struct qelem { | ||
| 20 | struct qelem *q_forw; | ||
| 21 | struct qelem *q_back; | ||
| 22 | char q_data[1]; | ||
| 23 | }; | ||
| 24 | |||
| 25 | /* | ||
| 26 | * XDeleteAssoc - Delete an association in an XAssocTable keyed on | ||
| 27 | * an XId. An association may be removed only once. Redundant | ||
| 28 | * deletes are meaningless (but cause no problems). | ||
| 29 | */ | ||
| 30 | XDeleteAssoc(dpy, table, x_id) | ||
| 31 | register Display *dpy; | ||
| 32 | register XAssocTable *table; | ||
| 33 | register XID x_id; | ||
| 34 | { | ||
| 35 | int hash; | ||
| 36 | register XAssoc *bucket; | ||
| 37 | register XAssoc *Entry; | ||
| 38 | |||
| 39 | /* Hash the XId to get the bucket number. */ | ||
| 40 | hash = x_id & (table->size - 1); | ||
| 41 | /* Look up the bucket to get the entries in that bucket. */ | ||
| 42 | bucket = &table->buckets[hash]; | ||
| 43 | /* Get the first entry in the bucket. */ | ||
| 44 | Entry = bucket->next; | ||
| 45 | |||
| 46 | /* Scan through the entries in the bucket for the right XId. */ | ||
| 47 | for (; Entry != bucket; Entry = Entry->next) { | ||
| 48 | if (Entry->x_id == x_id) { | ||
| 49 | /* We have the right XId. */ | ||
| 50 | if (Entry->display == dpy) { | ||
| 51 | /* We have the right display. */ | ||
| 52 | /* We have the right entry! */ | ||
| 53 | /* Remove it from the queue and */ | ||
| 54 | /* free the entry. */ | ||
| 55 | emacs_remque((struct qelem *)Entry); | ||
| 56 | free((char *)Entry); | ||
| 57 | return; | ||
| 58 | } | ||
| 59 | /* Oops, identical XId's on different displays! */ | ||
| 60 | continue; | ||
| 61 | } | ||
| 62 | if (Entry->x_id > x_id) { | ||
| 63 | /* We have gone past where it should be. */ | ||
| 64 | /* It is apparently not in the table. */ | ||
| 65 | return; | ||
| 66 | } | ||
| 67 | } | ||
| 68 | /* It is apparently not in the table. */ | ||
| 69 | return; | ||
| 70 | } | ||
| 71 | |||
diff --git a/oldXMenu/XDestAssoc.c b/oldXMenu/XDestAssoc.c new file mode 100644 index 00000000000..452dd223bd8 --- /dev/null +++ b/oldXMenu/XDestAssoc.c | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | /* $XConsortium: XDestAssoc.c,v 10.17 91/02/08 13:11:50 rws Exp $ */ | ||
| 2 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 3 | |||
| 4 | /* | ||
| 5 | Permission to use, copy, modify, distribute, and sell this software and its | ||
| 6 | documentation for any purpose is hereby granted without fee, provided that | ||
| 7 | the above copyright notice appear in all copies and that both that | ||
| 8 | copyright notice and this permission notice appear in supporting | ||
| 9 | documentation, and that the name of M.I.T. not be used in advertising or | ||
| 10 | publicity pertaining to distribution of the software without specific, | ||
| 11 | written prior permission. M.I.T. makes no representations about the | ||
| 12 | suitability of this software for any purpose. It is provided "as is" | ||
| 13 | without express or implied warranty. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <X11/Xlib.h> | ||
| 17 | #include "X10.h" | ||
| 18 | |||
| 19 | /* | ||
| 20 | * XDestroyAssocTable - Destroy (free the memory associated with) | ||
| 21 | * an XAssocTable. | ||
| 22 | */ | ||
| 23 | XDestroyAssocTable(table) | ||
| 24 | register XAssocTable *table; | ||
| 25 | { | ||
| 26 | register int i; | ||
| 27 | register XAssoc *bucket; | ||
| 28 | register XAssoc *Entry, *entry_next; | ||
| 29 | |||
| 30 | /* Free the buckets. */ | ||
| 31 | for (i = 0; i < table->size; i++) { | ||
| 32 | bucket = &table->buckets[i]; | ||
| 33 | for ( | ||
| 34 | Entry = bucket->next; | ||
| 35 | Entry != bucket; | ||
| 36 | Entry = entry_next | ||
| 37 | ) { | ||
| 38 | entry_next = Entry->next; | ||
| 39 | free((char *)Entry); | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 43 | /* Free the bucket array. */ | ||
| 44 | free((char *)table->buckets); | ||
| 45 | |||
| 46 | /* Free the table. */ | ||
| 47 | free((char *)table); | ||
| 48 | } | ||
| 49 | |||
diff --git a/oldXMenu/XLookAssoc.c b/oldXMenu/XLookAssoc.c new file mode 100644 index 00000000000..f80952a6345 --- /dev/null +++ b/oldXMenu/XLookAssoc.c | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | /* $XConsortium: XLookAssoc.c,v 10.16 91/01/06 12:09:24 rws Exp $ */ | ||
| 2 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 3 | |||
| 4 | /* | ||
| 5 | Permission to use, copy, modify, distribute, and sell this software and its | ||
| 6 | documentation for any purpose is hereby granted without fee, provided that | ||
| 7 | the above copyright notice appear in all copies and that both that | ||
| 8 | copyright notice and this permission notice appear in supporting | ||
| 9 | documentation, and that the name of M.I.T. not be used in advertising or | ||
| 10 | publicity pertaining to distribution of the software without specific, | ||
| 11 | written prior permission. M.I.T. makes no representations about the | ||
| 12 | suitability of this software for any purpose. It is provided "as is" | ||
| 13 | without express or implied warranty. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <X11/Xlib.h> | ||
| 17 | #include <X11/Xresource.h> | ||
| 18 | #include "X10.h" | ||
| 19 | |||
| 20 | #ifndef NULL | ||
| 21 | #define NULL 0 | ||
| 22 | #endif | ||
| 23 | |||
| 24 | /* | ||
| 25 | * XLookUpAssoc - Retrieve the data stored in an XAssocTable by its XId. | ||
| 26 | * If an appropriately matching XId can be found in the table the routine will | ||
| 27 | * return apointer to the data associated with it. If the XId can not be found | ||
| 28 | * in the table the routine will return a NULL pointer. All XId's are relative | ||
| 29 | * to the currently active Display. | ||
| 30 | */ | ||
| 31 | caddr_t XLookUpAssoc(dpy, table, x_id) | ||
| 32 | register Display *dpy; | ||
| 33 | register XAssocTable *table; /* XAssocTable to search in. */ | ||
| 34 | register XID x_id; /* XId to search for. */ | ||
| 35 | { | ||
| 36 | int hash; | ||
| 37 | register XAssoc *bucket; | ||
| 38 | register XAssoc *Entry; | ||
| 39 | |||
| 40 | /* Hash the XId to get the bucket number. */ | ||
| 41 | hash = x_id & (table->size - 1); | ||
| 42 | /* Look up the bucket to get the entries in that bucket. */ | ||
| 43 | bucket = &table->buckets[hash]; | ||
| 44 | /* Get the first entry in the bucket. */ | ||
| 45 | Entry = bucket->next; | ||
| 46 | |||
| 47 | /* Scan through the entries in the bucket for the right XId. */ | ||
| 48 | for (; Entry != bucket; Entry = Entry->next) { | ||
| 49 | if (Entry->x_id == x_id) { | ||
| 50 | /* We have the right XId. */ | ||
| 51 | if (Entry->display == dpy) { | ||
| 52 | /* We have the right display. */ | ||
| 53 | /* We have the right entry! */ | ||
| 54 | return(Entry->data); | ||
| 55 | } | ||
| 56 | /* Oops, identical XId's on different displays! */ | ||
| 57 | continue; | ||
| 58 | } | ||
| 59 | if (Entry->x_id > x_id) { | ||
| 60 | /* We have gone past where it should be. */ | ||
| 61 | /* It is apparently not in the table. */ | ||
| 62 | return(NULL); | ||
| 63 | } | ||
| 64 | } | ||
| 65 | /* It is apparently not in the table. */ | ||
| 66 | return(NULL); | ||
| 67 | } | ||
| 68 | |||
diff --git a/oldXMenu/XMakeAssoc.c b/oldXMenu/XMakeAssoc.c new file mode 100644 index 00000000000..d4682700ed2 --- /dev/null +++ b/oldXMenu/XMakeAssoc.c | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | /* $XConsortium: XMakeAssoc.c,v 10.18 91/01/06 12:09:28 rws Exp $ */ | ||
| 2 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 3 | |||
| 4 | /* | ||
| 5 | Permission to use, copy, modify, distribute, and sell this software and its | ||
| 6 | documentation for any purpose is hereby granted without fee, provided that | ||
| 7 | the above copyright notice appear in all copies and that both that | ||
| 8 | copyright notice and this permission notice appear in supporting | ||
| 9 | documentation, and that the name of M.I.T. not be used in advertising or | ||
| 10 | publicity pertaining to distribution of the software without specific, | ||
| 11 | written prior permission. M.I.T. makes no representations about the | ||
| 12 | suitability of this software for any purpose. It is provided "as is" | ||
| 13 | without express or implied warranty. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <config.h> | ||
| 17 | #include <X11/Xlib.h> | ||
| 18 | #include <X11/Xresource.h> | ||
| 19 | #include "X10.h" | ||
| 20 | #include <errno.h> | ||
| 21 | |||
| 22 | #ifndef NULL | ||
| 23 | #define NULL 0 | ||
| 24 | #endif | ||
| 25 | |||
| 26 | extern int errno; | ||
| 27 | |||
| 28 | void emacs_insque(); | ||
| 29 | struct qelem { | ||
| 30 | struct qelem *q_forw; | ||
| 31 | struct qelem *q_back; | ||
| 32 | char q_data[1]; | ||
| 33 | }; | ||
| 34 | /* | ||
| 35 | * XMakeAssoc - Insert data into an XAssocTable keyed on an XId. | ||
| 36 | * Data is inserted into the table only once. Redundant inserts are | ||
| 37 | * meaningless (but cause no problems). The queue in each association | ||
| 38 | * bucket is sorted (lowest XId to highest XId). | ||
| 39 | */ | ||
| 40 | XMakeAssoc(dpy, table, x_id, data) | ||
| 41 | register Display *dpy; | ||
| 42 | register XAssocTable *table; | ||
| 43 | register XID x_id; | ||
| 44 | register caddr_t data; | ||
| 45 | { | ||
| 46 | int hash; | ||
| 47 | register XAssoc *bucket; | ||
| 48 | register XAssoc *Entry; | ||
| 49 | register XAssoc *new_entry; | ||
| 50 | |||
| 51 | /* Hash the XId to get the bucket number. */ | ||
| 52 | hash = x_id & (table->size - 1); | ||
| 53 | /* Look up the bucket to get the entries in that bucket. */ | ||
| 54 | bucket = &table->buckets[hash]; | ||
| 55 | /* Get the first entry in the bucket. */ | ||
| 56 | Entry = bucket->next; | ||
| 57 | |||
| 58 | /* If (Entry != bucket), the bucket is empty so make */ | ||
| 59 | /* the new entry the first entry in the bucket. */ | ||
| 60 | /* if (Entry == bucket), the we have to search the */ | ||
| 61 | /* bucket. */ | ||
| 62 | if (Entry != bucket) { | ||
| 63 | /* The bucket isn't empty, begin searching. */ | ||
| 64 | /* If we leave the for loop then we have either passed */ | ||
| 65 | /* where the entry should be or hit the end of the bucket. */ | ||
| 66 | /* In either case we should then insert the new entry */ | ||
| 67 | /* before the current value of "Entry". */ | ||
| 68 | for (; Entry != bucket; Entry = Entry->next) { | ||
| 69 | if (Entry->x_id == x_id) { | ||
| 70 | /* Entry has the same XId... */ | ||
| 71 | if (Entry->display == dpy) { | ||
| 72 | /* Entry has the same Display... */ | ||
| 73 | /* Therefore there is already an */ | ||
| 74 | /* entry with this XId and Display, */ | ||
| 75 | /* reset its data value and return. */ | ||
| 76 | Entry->data = data; | ||
| 77 | return; | ||
| 78 | } | ||
| 79 | /* We found an association with the right */ | ||
| 80 | /* id but the wrong display! */ | ||
| 81 | continue; | ||
| 82 | } | ||
| 83 | /* If the current entry's XId is greater than the */ | ||
| 84 | /* XId of the entry to be inserted then we have */ | ||
| 85 | /* passed the location where the new XId should */ | ||
| 86 | /* be inserted. */ | ||
| 87 | if (Entry->x_id > x_id) break; | ||
| 88 | } | ||
| 89 | } | ||
| 90 | |||
| 91 | /* If we are here then the new entry should be inserted just */ | ||
| 92 | /* before the current value of "Entry". */ | ||
| 93 | /* Create a new XAssoc and load it with new provided data. */ | ||
| 94 | new_entry = (XAssoc *) xmalloc(sizeof(XAssoc)); | ||
| 95 | new_entry->display = dpy; | ||
| 96 | new_entry->x_id = x_id; | ||
| 97 | new_entry->data = data; | ||
| 98 | |||
| 99 | /* Insert the new entry. */ | ||
| 100 | emacs_insque((struct qelem *)new_entry, (struct qelem *)Entry->prev); | ||
| 101 | } | ||
| 102 | |||
diff --git a/oldXMenu/XMenu.h b/oldXMenu/XMenu.h new file mode 100644 index 00000000000..8b90c992d32 --- /dev/null +++ b/oldXMenu/XMenu.h | |||
| @@ -0,0 +1,262 @@ | |||
| 1 | #include "copyright.h" | ||
| 2 | |||
| 3 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/XMenu.h,v 1.1 1992/04/11 22:10:21 jimb Exp $ */ | ||
| 4 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 8 | * | ||
| 9 | * XMenu.h - Include file for the MIT Project Athena | ||
| 10 | * XMenu X window system menu package. | ||
| 11 | * | ||
| 12 | * Author: Tony Della Fera, DEC | ||
| 13 | * August, 1984 | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifndef _XMenu_h_ | ||
| 17 | #define _XMenu_h_ | ||
| 18 | |||
| 19 | #include <X11/Xutil.h> | ||
| 20 | #include "X10.h" | ||
| 21 | |||
| 22 | #define FAILURE -1 | ||
| 23 | #define SUCCESS 1 | ||
| 24 | #define POST_ERROR -1 | ||
| 25 | #define NO_SELECTION -1 | ||
| 26 | |||
| 27 | #define XM_FAILURE -1 | ||
| 28 | #define XM_SUCCESS 1 | ||
| 29 | #define XM_NO_SELECT 2 | ||
| 30 | #define XM_IA_SELECT 3 | ||
| 31 | |||
| 32 | #define XME_CODE_COUNT 17 | ||
| 33 | |||
| 34 | #define XME_NO_ERROR 0 | ||
| 35 | #define XME_NOT_INIT 1 | ||
| 36 | #define XME_ARG_BOUNDS 2 | ||
| 37 | #define XME_P_NOT_FOUND 3 | ||
| 38 | #define XME_S_NOT_FOUND 4 | ||
| 39 | #define XME_STYLE_PARAM 5 | ||
| 40 | #define XME_GRAB_MOUSE 6 | ||
| 41 | #define XME_INTERP_LOC 7 | ||
| 42 | #define XME_CALLOC 8 | ||
| 43 | #define XME_CREATE_ASSOC 9 | ||
| 44 | #define XME_STORE_BITMAP 10 | ||
| 45 | #define XME_MAKE_TILES 11 | ||
| 46 | #define XME_MAKE_PIXMAP 12 | ||
| 47 | #define XME_CREATE_CURSOR 13 | ||
| 48 | #define XME_OPEN_FONT 14 | ||
| 49 | #define XME_CREATE_WINDOW 15 | ||
| 50 | #define XME_CREATE_TRANSP 16 | ||
| 51 | |||
| 52 | /* | ||
| 53 | * XMenu error code and error list definitions. | ||
| 54 | */ | ||
| 55 | extern int _XMErrorCode; | ||
| 56 | extern char *_XMErrorList[]; | ||
| 57 | |||
| 58 | /* | ||
| 59 | * Define the XMWindow datatypes. | ||
| 60 | * | ||
| 61 | * An XMWindow is either an XMPane or an XMSelect. | ||
| 62 | * | ||
| 63 | * XMWindow is wrapper used to identify the constant window | ||
| 64 | * information that makes up XMPane and XMSelect objects. | ||
| 65 | * | ||
| 66 | * An XMPane is a menu pane made up of one or more XMSelect and a label. | ||
| 67 | * | ||
| 68 | * An XMSelect is a menu selection object with a label and a data pointer. | ||
| 69 | */ | ||
| 70 | typedef enum _xmwintype {PANE, SELECTION, PL_HEADER, SL_HEADER, SEPARATOR} XMWType; | ||
| 71 | |||
| 72 | typedef struct _xmwindow { | ||
| 73 | struct _xmwindow *next; /* Next obj pointer (for emacs_insque). */ | ||
| 74 | struct _xmwindow *prev; /* Prev obj pointer (for emacs_insque). */ | ||
| 75 | XMWType type; /* Type of window. */ | ||
| 76 | Window window; /* X Window Id. */ | ||
| 77 | int window_x; /* Window upper left X coordinate. */ | ||
| 78 | int window_y; /* Window upper left y coordinate. */ | ||
| 79 | int window_w; /* Window width. */ | ||
| 80 | int window_h; /* Window height. */ | ||
| 81 | int active; /* Window active? */ | ||
| 82 | int activated; /* Window activated? */ | ||
| 83 | int pad_l1; /* ---- */ | ||
| 84 | char *pad_l2; /* ---- */ | ||
| 85 | int pad_l3; /* ---- */ | ||
| 86 | int pad_l4; /* ---- */ | ||
| 87 | int pad_l5; /* ---- */ | ||
| 88 | int pad_l6; /* ---- */ | ||
| 89 | int pad_l7; /* ---- */ | ||
| 90 | int pad_l8; /* ---- */ | ||
| 91 | struct _xmwindow *pad_l9; /* ---- */ | ||
| 92 | char *pad_l10; /* ---- */ | ||
| 93 | struct _xmwindow *pad_l11; /* ---- */ | ||
| 94 | } XMWindow; | ||
| 95 | |||
| 96 | typedef struct _xmpane { | ||
| 97 | struct _xmpane *next; /* Next obj pointer (for emacs_insque). */ | ||
| 98 | struct _xmpane *prev; /* Prev obj pointer (for emacs_insque). */ | ||
| 99 | XMWType type; /* Type of window. */ | ||
| 100 | Window window; /* X Window Id. */ | ||
| 101 | int window_x; /* Window upper left X coordinate. */ | ||
| 102 | int window_y; /* Window upper left y coordinate. */ | ||
| 103 | int window_w; /* Window width. */ | ||
| 104 | int window_h; /* Window height. */ | ||
| 105 | int active; /* Window active? */ | ||
| 106 | int activated; /* Window activated? */ | ||
| 107 | int serial; /* -- Pane serial number. */ | ||
| 108 | char *label; /* -- Pane label. */ | ||
| 109 | int label_width; /* -- Pane label width in pixels. */ | ||
| 110 | int label_length; /* -- Pane label length in chars. */ | ||
| 111 | int label_x; /* -- Pane label X offset. */ | ||
| 112 | int label_uy; /* -- Pane label upper Y offset. */ | ||
| 113 | int label_ly; /* -- Pane label lower Y offset. */ | ||
| 114 | int s_count; /* -- Selections in this pane. */ | ||
| 115 | struct _xmselect *s_list; /* -- Selection window list. */ | ||
| 116 | char *pad_l10; /* ---- */ | ||
| 117 | struct _xmwindow *pad_l11; /* ---- */ | ||
| 118 | } XMPane; | ||
| 119 | |||
| 120 | typedef struct _xmselect { | ||
| 121 | struct _xmselect *next; /* Next obj pointer (for emacs_insque). */ | ||
| 122 | struct _xmselect *prev; /* Prev obj pointer (for emacs_insque). */ | ||
| 123 | XMWType type; /* Type of window. */ | ||
| 124 | Window window; /* X Window Id. */ | ||
| 125 | Window parent; /* X Window id of parent window. */ | ||
| 126 | int window_x; /* Window upper left X coordinate. */ | ||
| 127 | int window_y; /* Window upper left y coordinate. */ | ||
| 128 | int window_w; /* Window width. */ | ||
| 129 | int window_h; /* Window height. */ | ||
| 130 | int active; /* Window active? */ | ||
| 131 | int activated; /* Window activated? */ | ||
| 132 | int serial; /* -- Selection serial number. */ | ||
| 133 | char *label; /* -- Selection label. */ | ||
| 134 | int label_width; /* -- Selection label width in pixels. */ | ||
| 135 | int label_length; /* -- Selection label length in chars. */ | ||
| 136 | int label_x; /* -- Selection label X offset. */ | ||
| 137 | int label_y; /* -- Selection label Y offset. */ | ||
| 138 | int pad_l7; /* ---- */ | ||
| 139 | int pad_l8; /* ---- */ | ||
| 140 | struct _xmwindow *pad_l9; /* ---- */ | ||
| 141 | char *data; /* -- Selection data pointer. */ | ||
| 142 | struct _xmpane *parent_p; /* -- Selection parent pane structure. */ | ||
| 143 | } XMSelect; | ||
| 144 | |||
| 145 | |||
| 146 | /* | ||
| 147 | * Define the XMStyle datatype. | ||
| 148 | * | ||
| 149 | * Menu presentation style information. | ||
| 150 | * | ||
| 151 | */ | ||
| 152 | typedef enum _xmstyle { | ||
| 153 | LEFT, /* Left oriented obejct. */ | ||
| 154 | RIGHT, /* Right oriented obejct. */ | ||
| 155 | CENTER /* Center oriented object. */ | ||
| 156 | } XMStyle; | ||
| 157 | |||
| 158 | |||
| 159 | /* | ||
| 160 | * Define the XMMode datatype. | ||
| 161 | * | ||
| 162 | * Menu presentation mode information. | ||
| 163 | * | ||
| 164 | */ | ||
| 165 | typedef enum _xmmode { | ||
| 166 | BOX, /* BOXed graphic rendition. */ | ||
| 167 | INVERT /* INVERTed graphic rendition. */ | ||
| 168 | } XMMode; | ||
| 169 | |||
| 170 | |||
| 171 | /* | ||
| 172 | * Define the XMenu datatype. | ||
| 173 | * | ||
| 174 | * All dimensions are in pixels unless otherwise noted. | ||
| 175 | */ | ||
| 176 | typedef struct _xmenu { | ||
| 177 | /* -------------------- Menu data -------------------- */ | ||
| 178 | XMStyle menu_style; /* Menu display style. */ | ||
| 179 | XMMode menu_mode; /* Menu display mode. */ | ||
| 180 | int freeze; /* Freeze server mode? */ | ||
| 181 | int aeq; /* Asynchronous Event Queuing mode? */ | ||
| 182 | int recompute; /* Recompute menu dependencies? */ | ||
| 183 | Window parent; /* Menu's parent window. */ | ||
| 184 | int width; /* Overall menu width. */ | ||
| 185 | int height; /* Overall menu height. */ | ||
| 186 | int x_pos; /* Oveall menu origin. */ | ||
| 187 | int y_pos; /* Overall menu origin. */ | ||
| 188 | Cursor mouse_cursor; /* Mouse cursor raster. */ | ||
| 189 | XAssocTable *assoc_tab; /* XMWindow association table. */ | ||
| 190 | XMPane *p_list; /* List of XMPanes. */ | ||
| 191 | /* -------------------- Pane window data -------------------- */ | ||
| 192 | XMStyle p_style; /* Pane display style. */ | ||
| 193 | int p_events; /* Pane window X events. */ | ||
| 194 | XFontStruct *p_fnt_info; /* Flag font info structure. */ | ||
| 195 | GC pane_GC; /* Pane graphics context. */ | ||
| 196 | int p_fnt_pad; /* Fixed flag font padding in pixels. */ | ||
| 197 | double p_spread; /* Pane spread in flag height fractions. */ | ||
| 198 | int p_bdr_width; /* Pane border width. */ | ||
| 199 | int flag_height; /* Flag height. */ | ||
| 200 | int p_width; /* Menu pane width. */ | ||
| 201 | int p_height; /* Menu pane height. */ | ||
| 202 | int p_x_off; /* Pane window X offset. */ | ||
| 203 | int p_y_off; /* Pane window Y offset. */ | ||
| 204 | int p_count; /* Number of panes per menu. */ | ||
| 205 | /* -------------------- Selection window data -------------------- */ | ||
| 206 | XMStyle s_style; /* Selection display style. */ | ||
| 207 | int s_events; /* Selection window X events. */ | ||
| 208 | XFontStruct *s_fnt_info; /* Body font info structure. */ | ||
| 209 | int s_fnt_pad; /* Fixed body font padding in pixels. */ | ||
| 210 | double s_spread; /* Select spread in line height fractions. */ | ||
| 211 | int s_bdr_width; /* Select border width. */ | ||
| 212 | int s_width; /* Selection window width. */ | ||
| 213 | int s_height; /* Selection window height. */ | ||
| 214 | int s_x_off; /* Selection window X offset. */ | ||
| 215 | int s_y_off; /* Selection window Y offset. */ | ||
| 216 | int s_count; /* Maximum number of selections per pane. */ | ||
| 217 | GC normal_select_GC; /* GC used for inactive selections. */ | ||
| 218 | GC inverse_select_GC; /* GC used for active (current) selection. */ | ||
| 219 | GC inact_GC; /* GC used for inactive selections and */ | ||
| 220 | /* panes headers. */ | ||
| 221 | /* -------------------- Color data -------------------- */ | ||
| 222 | unsigned long p_bdr_color; /* Color of pane border pixmap. */ | ||
| 223 | unsigned long s_bdr_color; /* Color of selection border pixmap. */ | ||
| 224 | unsigned long p_frg_color; /* Color of pane foreground pixmap. */ | ||
| 225 | unsigned long s_frg_color; /* Color of selection pixmap. */ | ||
| 226 | unsigned long bkgnd_color; /* Color of menu background pixmap. */ | ||
| 227 | /* -------------------- Pixmap data -------------------- */ | ||
| 228 | Pixmap p_bdr_pixmap; /* Pane border pixmap. */ | ||
| 229 | Pixmap s_bdr_pixmap; /* Selection border pixmap. */ | ||
| 230 | Pixmap p_frg_pixmap; /* Pane foreground pixmap. */ | ||
| 231 | Pixmap s_frg_pixmap; /* Selection foreground pixmap. */ | ||
| 232 | Pixmap bkgnd_pixmap; /* Menu background pixmap. */ | ||
| 233 | Pixmap inact_pixmap; /* Menu inactive pixmap. */ | ||
| 234 | } XMenu; | ||
| 235 | |||
| 236 | /* | ||
| 237 | * XMenu library routine declarations. | ||
| 238 | */ | ||
| 239 | XMenu *XMenuCreate(); | ||
| 240 | int XMenuAddPane(); | ||
| 241 | int XMenuAddSelection(); | ||
| 242 | int XMenuInsertPane(); | ||
| 243 | int XMenuInsertSelection(); | ||
| 244 | int XMenuFindPane(); | ||
| 245 | int XMenuFindSelection(); | ||
| 246 | int XMenuChangePane(); | ||
| 247 | int XMenuChangeSelection(); | ||
| 248 | int XMenuSetPane(); | ||
| 249 | int XMenuSetSelection(); | ||
| 250 | int XMenuRecompute(); | ||
| 251 | int XMenuEventHandler(); /* No value actually returned. */ | ||
| 252 | int XMenuLocate(); | ||
| 253 | int XMenuSetFreeze(); /* No value actually returned. */ | ||
| 254 | int XMenuActivate(); | ||
| 255 | char *XMenuPost(); | ||
| 256 | int XMenuDeletePane(); | ||
| 257 | int XMenuDeleteSelection(); | ||
| 258 | int XMenuDestroy(); /* No value actually returned. */ | ||
| 259 | char *XMenuError(); | ||
| 260 | |||
| 261 | #endif | ||
| 262 | /* Don't add after this point. */ | ||
diff --git a/oldXMenu/XMenuInt.h b/oldXMenu/XMenuInt.h new file mode 100644 index 00000000000..7f3f013509a --- /dev/null +++ b/oldXMenu/XMenuInt.h | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | |||
| 2 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/XMenuInt.h,v 1.3 1992/10/10 16:05:10 jimb Exp $ */ | ||
| 3 | /* Copyright Massachusetts Institute of Technology 1985 */ | ||
| 4 | |||
| 5 | /* | ||
| 6 | * XMenu: MIT Project Athena, X Window system menu package | ||
| 7 | * | ||
| 8 | * XMenuInternal.h - Internal menu system include file for the | ||
| 9 | * MIT Project Athena XMenu X window system | ||
| 10 | * menu package. | ||
| 11 | * | ||
| 12 | * Author: Tony Della Fera, DEC | ||
| 13 | * October, 1985 | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifndef _XMenuInternal_h_ | ||
| 17 | #define _XMenuInternal_h_ | ||
| 18 | |||
| 19 | /* Avoid warnings about redefining NULL by including <stdio.h> first; | ||
| 20 | the other file which wants to define it (<stddef.h> on Ultrix | ||
| 21 | systems) can deal if NULL is already defined, but <stdio.h> can't. */ | ||
| 22 | #include <stdio.h> | ||
| 23 | #include <X11/Xlib.h> | ||
| 24 | #include "X10.h" | ||
| 25 | #include "XMenu.h" | ||
| 26 | |||
| 27 | #define min(x, y) ((x) <= (y) ? (x) : (y)) | ||
| 28 | #define max(x, y) ((x) >= (y) ? (x) : (y)) | ||
| 29 | #define abs(a) ((a) < 0 ? -(a) : (a)) | ||
| 30 | |||
| 31 | #define _X_FAILURE -1 | ||
| 32 | |||
| 33 | #define _SUCCESS 1 | ||
| 34 | #define _FAILURE -1 | ||
| 35 | |||
| 36 | /* | ||
| 37 | * XMenu internal event handler variable. | ||
| 38 | */ | ||
| 39 | extern int (*_XMEventHandler)(); | ||
| 40 | |||
| 41 | #ifndef Pixel | ||
| 42 | #define Pixel unsigned long | ||
| 43 | #endif | ||
| 44 | |||
| 45 | /* | ||
| 46 | * Internal routine declarations. | ||
| 47 | */ | ||
| 48 | int _XMWinQueInit(); /* No value actually returned. */ | ||
| 49 | int _XMWinQueAddPane(); | ||
| 50 | int _XMWinQueAddSelection(); | ||
| 51 | int _XMWinQueFlush(); | ||
| 52 | XMPane *_XMGetPanePtr(); | ||
| 53 | XMSelect *_XMGetSelectionPtr(); | ||
| 54 | int _XMRecomputeGlobals(); /* No value actually returned. */ | ||
| 55 | int _XMRecomputePane(); | ||
| 56 | int _XMRecomputeSelection(); | ||
| 57 | int _XMTransToOrigin(); /* No value actually returned. */ | ||
| 58 | int _XMRefreshPane(); /* No value actually returned. */ | ||
| 59 | int _XMRefreshSelections(); /* No value actually returned. */ | ||
| 60 | int _XMHighlightSelection(); /* No value actually returned. */ | ||
| 61 | |||
| 62 | #endif | ||
| 63 | /* Don't add stuff after this #endif */ | ||
diff --git a/oldXMenu/compile.com b/oldXMenu/compile.com new file mode 100644 index 00000000000..0ed2a6ba4d4 --- /dev/null +++ b/oldXMenu/compile.com | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | $! This file was autogenerated with the command: | ||
| 2 | $! | ||
| 3 | $! mms/noaction/output = compile.com | ||
| 4 | $ if f$search("ACTIVATE.OBJ") then delete ACTIVATE.OBJ.* | ||
| 5 | $ cc /obj=ACTIVATE.OBJ /NOLIST/OBJECT=ACTIVATE.OBJ ACTIVATE.c | ||
| 6 | $ if f$search("ADDPANE.OBJ") then delete ADDPANE.OBJ.* | ||
| 7 | $ cc /obj=ADDPANE.OBJ /NOLIST/OBJECT=ADDPANE.OBJ ADDPANE.c | ||
| 8 | $ if f$search("ADDSEL.OBJ") then delete ADDSEL.OBJ.* | ||
| 9 | $ cc /obj=ADDSEL.OBJ /NOLIST/OBJECT=ADDSEL.OBJ ADDSEL.c | ||
| 10 | $ if f$search("CHGPANE.OBJ") then delete CHGPANE.OBJ.* | ||
| 11 | $ cc /obj=CHGPANE.OBJ /NOLIST/OBJECT=CHGPANE.OBJ CHGPANE.c | ||
| 12 | $ if f$search("CHGSEL.OBJ") then delete CHGSEL.OBJ.* | ||
| 13 | $ cc /obj=CHGSEL.OBJ /NOLIST/OBJECT=CHGSEL.OBJ CHGSEL.c | ||
| 14 | $ if f$search("CREATE.OBJ") then delete CREATE.OBJ.* | ||
| 15 | $ cc /obj=CREATE.OBJ /NOLIST/OBJECT=CREATE.OBJ CREATE.c | ||
| 16 | $ if f$search("DELPANE.OBJ") then delete DELPANE.OBJ.* | ||
| 17 | $ cc /obj=DELPANE.OBJ /NOLIST/OBJECT=DELPANE.OBJ DELPANE.c | ||
| 18 | $ if f$search("DELSEL.OBJ") then delete DELSEL.OBJ.* | ||
| 19 | $ cc /obj=DELSEL.OBJ /NOLIST/OBJECT=DELSEL.OBJ DELSEL.c | ||
| 20 | $ if f$search("DESTROY.OBJ") then delete DESTROY.OBJ.* | ||
| 21 | $ cc /obj=DESTROY.OBJ /NOLIST/OBJECT=DESTROY.OBJ DESTROY.c | ||
| 22 | $ if f$search("ERROR.OBJ") then delete ERROR.OBJ.* | ||
| 23 | $ cc /obj=ERROR.OBJ /NOLIST/OBJECT=ERROR.OBJ ERROR.c | ||
| 24 | $ if f$search("EVHAND.OBJ") then delete EVHAND.OBJ.* | ||
| 25 | $ cc /obj=EVHAND.OBJ /NOLIST/OBJECT=EVHAND.OBJ EVHAND.c | ||
| 26 | $ if f$search("FINDPANE.OBJ") then delete FINDPANE.OBJ.* | ||
| 27 | $ cc /obj=FINDPANE.OBJ /NOLIST/OBJECT=FINDPANE.OBJ FINDPANE.c | ||
| 28 | $ if f$search("FINDSEL.OBJ") then delete FINDSEL.OBJ.* | ||
| 29 | $ cc /obj=FINDSEL.OBJ /NOLIST/OBJECT=FINDSEL.OBJ FINDSEL.c | ||
| 30 | $ if f$search("INSPANE.OBJ") then delete INSPANE.OBJ.* | ||
| 31 | $ cc /obj=INSPANE.OBJ /NOLIST/OBJECT=INSPANE.OBJ INSPANE.c | ||
| 32 | $ if f$search("INSSEL.OBJ") then delete INSSEL.OBJ.* | ||
| 33 | $ cc /obj=INSSEL.OBJ /NOLIST/OBJECT=INSSEL.OBJ INSSEL.c | ||
| 34 | $ if f$search("INTERNAL.OBJ") then delete INTERNAL.OBJ.* | ||
| 35 | $ cc /obj=INTERNAL.OBJ /NOLIST/OBJECT=INTERNAL.OBJ INTERNAL.c | ||
| 36 | $ if f$search("LOCATE.OBJ") then delete LOCATE.OBJ.* | ||
| 37 | $ cc /obj=LOCATE.OBJ /NOLIST/OBJECT=LOCATE.OBJ LOCATE.c | ||
| 38 | $ if f$search("POST.OBJ") then delete POST.OBJ.* | ||
| 39 | $ cc /obj=POST.OBJ /NOLIST/OBJECT=POST.OBJ POST.c | ||
| 40 | $ if f$search("RECOMP.OBJ") then delete RECOMP.OBJ.* | ||
| 41 | $ cc /obj=RECOMP.OBJ /NOLIST/OBJECT=RECOMP.OBJ RECOMP.c | ||
| 42 | $ if f$search("SETAEQ.OBJ") then delete SETAEQ.OBJ.* | ||
| 43 | $ cc /obj=SETAEQ.OBJ /NOLIST/OBJECT=SETAEQ.OBJ SETAEQ.c | ||
| 44 | $ if f$search("SETFRZ.OBJ") then delete SETFRZ.OBJ.* | ||
| 45 | $ cc /obj=SETFRZ.OBJ /NOLIST/OBJECT=SETFRZ.OBJ SETFRZ.c | ||
| 46 | $ if f$search("SETPANE.OBJ") then delete SETPANE.OBJ.* | ||
| 47 | $ cc /obj=SETPANE.OBJ /NOLIST/OBJECT=SETPANE.OBJ SETPANE.c | ||
| 48 | $ if f$search("SETSEL.OBJ") then delete SETSEL.OBJ.* | ||
| 49 | $ cc /obj=SETSEL.OBJ /NOLIST/OBJECT=SETSEL.OBJ SETSEL.c | ||
| 50 | $ if f$search("XDELASSOC.OBJ") then delete XDELASSOC.OBJ.* | ||
| 51 | $ cc /obj=XDELASSOC.OBJ /NOLIST/OBJECT=XDELASSOC.OBJ XDELASSOC.c | ||
| 52 | $ if f$search("XLOOKASSOC.OBJ") then delete XLOOKASSOC.OBJ.* | ||
| 53 | $ cc /obj=XLOOKASSOC.OBJ /NOLIST/OBJECT=XLOOKASSOC.OBJ XLOOKASSOC.c | ||
| 54 | $ if f$search("XCRASSOC.OBJ") then delete XCRASSOC.OBJ.* | ||
| 55 | $ cc /obj=XCRASSOC.OBJ /NOLIST/OBJECT=XCRASSOC.OBJ XCRASSOC.c | ||
| 56 | $ if f$search("XDESTASSOC.OBJ") then delete XDESTASSOC.OBJ.* | ||
| 57 | $ cc /obj=XDESTASSOC.OBJ /NOLIST/OBJECT=XDESTASSOC.OBJ XDESTASSOC.c | ||
| 58 | $ if f$search("XMAKEASSOC.OBJ") then delete XMAKEASSOC.OBJ.* | ||
| 59 | $ cc /obj=XMAKEASSOC.OBJ /NOLIST/OBJECT=XMAKEASSOC.OBJ XMAKEASSOC.c | ||
| 60 | $ if f$search("INSQUE.OBJ") then delete INSQUE.OBJ.* | ||
| 61 | $ cc /obj=INSQUE.OBJ /NOLIST/OBJECT=INSQUE.OBJ INSQUE.c | ||
| 62 | $ if f$search("LIBXMENU11.OLB") then delete LIBXMENU11.OLB.* | ||
| 63 | $ library/insert/create LIBXMENU11.OLB Activate.obj, AddPane.obj, AddSel.obj, ChgPane.obj, ChgSel.obj, Create.obj, DelPane.obj, DelSel.obj, Destroy.obj, Error.obj, EvHand.obj, FindPane.obj, FindSel.obj, InsPane.obj, InsSel.obj, Internal.- | ||
| 64 | obj, Locate.obj, Post.obj, Recomp.obj, SetAEQ.obj, SetFrz.obj, SetPane.obj, SetSel.obj, XDelAssoc.obj, XLookAssoc.obj, XCrAssoc.obj, XDestAssoc.obj, XMakeAssoc.obj | ||
| 65 | $ if ("insque.obj" .nes. "") then library/insert LIBXMENU11.OLB insque.obj | ||
| 66 | $ ! | ||
diff --git a/oldXMenu/copyright.h b/oldXMenu/copyright.h new file mode 100644 index 00000000000..1cd0883c70e --- /dev/null +++ b/oldXMenu/copyright.h | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/copyright.h,v 1.1 1992/04/11 22:10:22 jimb Exp $ */ | ||
| 2 | /* | ||
| 3 | |||
| 4 | Copyright 1985, 1986, 1987 by the Massachusetts Institute of Technology | ||
| 5 | |||
| 6 | Permission to use, copy, modify, and distribute this | ||
| 7 | software and its documentation for any purpose and without | ||
| 8 | fee is hereby granted, provided that the above copyright | ||
| 9 | notice appear in all copies and that both that copyright | ||
| 10 | notice and this permission notice appear in supporting | ||
| 11 | documentation, and that the name of M.I.T. not be used in | ||
| 12 | advertising or publicity pertaining to distribution of the | ||
| 13 | software without specific, written prior permission. | ||
| 14 | M.I.T. makes no representations about the suitability of | ||
| 15 | this software for any purpose. It is provided "as is" | ||
| 16 | without express or implied warranty. | ||
| 17 | |||
| 18 | */ | ||
| 19 | |||
diff --git a/oldXMenu/descrip.mms b/oldXMenu/descrip.mms new file mode 100644 index 00000000000..6ecd694bf08 --- /dev/null +++ b/oldXMenu/descrip.mms | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | !# Uncomment following line if linking temacs complains about missing insque. | ||
| 2 | EXTRA=insque.obj | ||
| 3 | |||
| 4 | AS = as | ||
| 5 | CC = cc | ||
| 6 | LD = link | ||
| 7 | TAGS = etags | ||
| 8 | RM = delete | ||
| 9 | MV = rename | ||
| 10 | AR = library/insert | ||
| 11 | MAKE = mms | ||
| 12 | STD_DEFINES = | ||
| 13 | CDEBUGFLAGS = /debug/noopt | ||
| 14 | RM_CMD = $(RM) *.BAK.*, *.obj.* | ||
| 15 | |||
| 16 | SRCS = Activate.c, - | ||
| 17 | AddPane.c, - | ||
| 18 | AddSel.c, - | ||
| 19 | ChgPane.c, - | ||
| 20 | ChgSel.c, - | ||
| 21 | Create.c, - | ||
| 22 | DelPane.c, - | ||
| 23 | DelSel.c, - | ||
| 24 | Destroy.c, - | ||
| 25 | Error.c, - | ||
| 26 | EvHand.c, - | ||
| 27 | FindPane.c, - | ||
| 28 | FindSel.c, - | ||
| 29 | InsPane.c, - | ||
| 30 | InsSel.c, - | ||
| 31 | Internal.c, - | ||
| 32 | Locate.c, - | ||
| 33 | Post.c, - | ||
| 34 | Recomp.c, - | ||
| 35 | SetAEQ.c, - | ||
| 36 | SetFrz.c, - | ||
| 37 | SetPane.c, - | ||
| 38 | SetSel.c, - | ||
| 39 | XDelAssoc.c, XLookAssoc.c, XCrAssoc.c, XDestAssoc.c, XMakeAssoc.c | ||
| 40 | |||
| 41 | OBJS = Activate.obj, - | ||
| 42 | AddPane.obj, - | ||
| 43 | AddSel.obj, - | ||
| 44 | ChgPane.obj, - | ||
| 45 | ChgSel.obj, - | ||
| 46 | Create.obj, - | ||
| 47 | DelPane.obj, - | ||
| 48 | DelSel.obj, - | ||
| 49 | Destroy.obj, - | ||
| 50 | Error.obj, - | ||
| 51 | EvHand.obj, - | ||
| 52 | FindPane.obj, - | ||
| 53 | FindSel.obj, - | ||
| 54 | InsPane.obj, - | ||
| 55 | InsSel.obj, - | ||
| 56 | Internal.obj, - | ||
| 57 | Locate.obj, - | ||
| 58 | Post.obj, - | ||
| 59 | Recomp.obj, - | ||
| 60 | SetAEQ.obj, - | ||
| 61 | SetFrz.obj, - | ||
| 62 | SetPane.obj, - | ||
| 63 | SetSel.obj, - | ||
| 64 | XDelAssoc.obj, XLookAssoc.obj, XCrAssoc.obj, XDestAssoc.obj, - | ||
| 65 | XMakeAssoc.obj | ||
| 66 | |||
| 67 | .c.obj : | ||
| 68 | if f$search("$@") then $(RM) $@.* | ||
| 69 | $(CC) /obj=$@ $(CFLAGS) $*.c | ||
| 70 | |||
| 71 | all :: libXMenu11.olb | ||
| 72 | ! | ||
| 73 | |||
| 74 | libXMenu11.olb : $(OBJS) $(EXTRA) | ||
| 75 | if f$search("$@") then $(RM) $@.* | ||
| 76 | $(AR)/create $@ $(OBJS) | ||
| 77 | if ("$(EXTRA)" .nes. "") then $(AR) $@ $(EXTRA) | ||
| 78 | #If running ranlib fails, probably there is none. | ||
| 79 | #That's ok. So don't stop the build. | ||
| 80 | |||
| 81 | distclean : clean | ||
| 82 | ! | ||
| 83 | |||
| 84 | clean :: | ||
| 85 | $(RM_CMD) \#* libXMenu11.a *.obj, | ||
| 86 | tags :: | ||
| 87 | $(TAGS) -t *.[ch] | ||
| 88 | |||
diff --git a/oldXMenu/insque.c b/oldXMenu/insque.c new file mode 100644 index 00000000000..4d264434d26 --- /dev/null +++ b/oldXMenu/insque.c | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | /* This file implements the emacs_insque and emacs_remque functions, | ||
| 2 | copies of the insque and remque functions of BSD. They and all | ||
| 3 | their callers have been renamed to emacs_mumble to allow us to | ||
| 4 | include this file in the menu library on all systems. */ | ||
| 5 | |||
| 6 | |||
| 7 | struct qelem { | ||
| 8 | struct qelem *q_forw; | ||
| 9 | struct qelem *q_back; | ||
| 10 | char q_data[1]; | ||
| 11 | }; | ||
| 12 | |||
| 13 | /* Insert ELEM into a doubly-linked list, after PREV. */ | ||
| 14 | |||
| 15 | void | ||
| 16 | emacs_insque (elem, prev) | ||
| 17 | struct qelem *elem, *prev; | ||
| 18 | { | ||
| 19 | struct qelem *next = prev->q_forw; | ||
| 20 | prev->q_forw = elem; | ||
| 21 | if (next) | ||
| 22 | next->q_back = elem; | ||
| 23 | elem->q_forw = next; | ||
| 24 | elem->q_back = prev; | ||
| 25 | } | ||
| 26 | |||
| 27 | /* Unlink ELEM from the doubly-linked list that it is in. */ | ||
| 28 | |||
| 29 | emacs_remque (elem) | ||
| 30 | struct qelem *elem; | ||
| 31 | { | ||
| 32 | struct qelem *next = elem->q_forw; | ||
| 33 | struct qelem *prev = elem->q_back; | ||
| 34 | if (next) | ||
| 35 | next->q_back = prev; | ||
| 36 | if (prev) | ||
| 37 | prev->q_forw = next; | ||
| 38 | } | ||