diff options
| author | Eli Zaretskii | 2000-01-27 17:07:27 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2000-01-27 17:07:27 +0000 |
| commit | e25d96531e97940c306ba9ca940e3646957aba90 (patch) | |
| tree | 33bc2414a589b5caa55ea509db3d6d5d970a8a62 /src | |
| parent | a0b796e3ede0f72979ab63d99cac04eb6a73c732 (diff) | |
| download | emacs-e25d96531e97940c306ba9ca940e3646957aba90.tar.gz emacs-e25d96531e97940c306ba9ca940e3646957aba90.zip | |
(IT_clear_end_of_line): Print the extent of the cleared
part of the line to the termscript file.
(IT_clear_to_end): Clear the entire line, not just its beginning.
(menu_help_message, prev_menu_help_message): New variables.
(IT_menu_make_room): Make room for the help_text member.
(IT_menu_display): New argument disp_help; all callers changed.
If disp_help is non-zero, store the help text of the active menu
item in menu_help_message.
(XMenuAddPane): Initialize the help_text member to NULL.
(XMenuAddSelection): New argument help_text. Store it in the
XMenu structure.
(XMenuActivate): New argument help_callback. If the value of
menu_help_message has changed since the last time, display the
menu help message text while waiting for the mouse to move. Clear
the echo area before exiting.
(XMenuDestroy): Free the help_text member.
Diffstat (limited to 'src')
| -rw-r--r-- | src/msdos.c | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/src/msdos.c b/src/msdos.c index fc1509b6010..20e094003b8 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -1513,9 +1513,9 @@ IT_clear_end_of_line (int first_unused) | |||
| 1513 | return; | 1513 | return; |
| 1514 | 1514 | ||
| 1515 | IT_set_face (0); | 1515 | IT_set_face (0); |
| 1516 | if (termscript) | ||
| 1517 | fprintf (termscript, "<CLR:EOL>"); | ||
| 1518 | i = (j = first_unused - new_pos_X) * 2; | 1516 | i = (j = first_unused - new_pos_X) * 2; |
| 1517 | if (termscript) | ||
| 1518 | fprintf (termscript, "<CLR:EOL[%d..%d)>", new_pos_X, first_unused); | ||
| 1519 | spaces = sp = alloca (i); | 1519 | spaces = sp = alloca (i); |
| 1520 | 1520 | ||
| 1521 | while (--j >= 0) | 1521 | while (--j >= 0) |
| @@ -1555,7 +1555,7 @@ IT_clear_to_end (void) | |||
| 1555 | 1555 | ||
| 1556 | while (new_pos_Y < screen_size_Y) { | 1556 | while (new_pos_Y < screen_size_Y) { |
| 1557 | new_pos_X = 0; | 1557 | new_pos_X = 0; |
| 1558 | IT_clear_end_of_line (0); | 1558 | IT_clear_end_of_line (screen_size_X); |
| 1559 | new_pos_Y++; | 1559 | new_pos_Y++; |
| 1560 | } | 1560 | } |
| 1561 | } | 1561 | } |
| @@ -3172,6 +3172,8 @@ glyph_to_pixel_coords (f, x, y, pix_x, pix_y) | |||
| 3172 | grab the nearest Xlib manual (down the hall, second-to-last door on the | 3172 | grab the nearest Xlib manual (down the hall, second-to-last door on the |
| 3173 | left), but I don't think it's worth the effort. */ | 3173 | left), but I don't think it's worth the effort. */ |
| 3174 | 3174 | ||
| 3175 | static char *menu_help_message, *prev_menu_help_message; | ||
| 3176 | |||
| 3175 | static XMenu * | 3177 | static XMenu * |
| 3176 | IT_menu_create () | 3178 | IT_menu_create () |
| 3177 | { | 3179 | { |
| @@ -3194,6 +3196,7 @@ IT_menu_make_room (XMenu *menu) | |||
| 3194 | menu->text = (char **) xmalloc (count * sizeof (char *)); | 3196 | menu->text = (char **) xmalloc (count * sizeof (char *)); |
| 3195 | menu->submenu = (XMenu **) xmalloc (count * sizeof (XMenu *)); | 3197 | menu->submenu = (XMenu **) xmalloc (count * sizeof (XMenu *)); |
| 3196 | menu->panenumber = (int *) xmalloc (count * sizeof (int)); | 3198 | menu->panenumber = (int *) xmalloc (count * sizeof (int)); |
| 3199 | menu->help_text = (char **) xmalloc (count * sizeof (char *)); | ||
| 3197 | } | 3200 | } |
| 3198 | else if (menu->allocated == menu->count) | 3201 | else if (menu->allocated == menu->count) |
| 3199 | { | 3202 | { |
| @@ -3204,6 +3207,8 @@ IT_menu_make_room (XMenu *menu) | |||
| 3204 | = (XMenu **) xrealloc (menu->submenu, count * sizeof (XMenu *)); | 3207 | = (XMenu **) xrealloc (menu->submenu, count * sizeof (XMenu *)); |
| 3205 | menu->panenumber | 3208 | menu->panenumber |
| 3206 | = (int *) xrealloc (menu->panenumber, count * sizeof (int)); | 3209 | = (int *) xrealloc (menu->panenumber, count * sizeof (int)); |
| 3210 | menu->help_text | ||
| 3211 | = (char **) xrealloc (menu->help_text, count * sizeof (char *)); | ||
| 3207 | } | 3212 | } |
| 3208 | } | 3213 | } |
| 3209 | 3214 | ||
| @@ -3251,7 +3256,7 @@ IT_menu_calc_size (XMenu *menu, int *width, int *height) | |||
| 3251 | /* Display MENU at (X,Y) using FACES. */ | 3256 | /* Display MENU at (X,Y) using FACES. */ |
| 3252 | 3257 | ||
| 3253 | static void | 3258 | static void |
| 3254 | IT_menu_display (XMenu *menu, int y, int x, int *faces) | 3259 | IT_menu_display (XMenu *menu, int y, int x, int *faces, int disp_help) |
| 3255 | { | 3260 | { |
| 3256 | int i, j, face, width; | 3261 | int i, j, face, width; |
| 3257 | struct glyph *text, *p; | 3262 | struct glyph *text, *p; |
| @@ -3261,6 +3266,8 @@ IT_menu_display (XMenu *menu, int y, int x, int *faces) | |||
| 3261 | int row, col; | 3266 | int row, col; |
| 3262 | struct frame *sf = SELECTED_FRAME(); | 3267 | struct frame *sf = SELECTED_FRAME(); |
| 3263 | 3268 | ||
| 3269 | menu_help_message = NULL; | ||
| 3270 | |||
| 3264 | width = menu->width; | 3271 | width = menu->width; |
| 3265 | text = (struct glyph *) xmalloc ((width + 2) * sizeof (struct glyph)); | 3272 | text = (struct glyph *) xmalloc ((width + 2) * sizeof (struct glyph)); |
| 3266 | ScreenGetCursor (&row, &col); | 3273 | ScreenGetCursor (&row, &col); |
| @@ -3275,6 +3282,8 @@ IT_menu_display (XMenu *menu, int y, int x, int *faces) | |||
| 3275 | = (!menu->submenu[i] && menu->panenumber[i]) || (menu->submenu[i]); | 3282 | = (!menu->submenu[i] && menu->panenumber[i]) || (menu->submenu[i]); |
| 3276 | mousehere = (y + i == my && x <= mx && mx < x + width + 2); | 3283 | mousehere = (y + i == my && x <= mx && mx < x + width + 2); |
| 3277 | face = faces[enabled + mousehere * 2]; | 3284 | face = faces[enabled + mousehere * 2]; |
| 3285 | if (disp_help && enabled + mousehere * 2 >= 2) | ||
| 3286 | menu_help_message = menu->help_text[i]; | ||
| 3278 | p = text; | 3287 | p = text; |
| 3279 | SET_CHAR_GLYPH (*p, ' ', face, 0); | 3288 | SET_CHAR_GLYPH (*p, ' ', face, 0); |
| 3280 | p++; | 3289 | p++; |
| @@ -3347,6 +3356,7 @@ XMenuAddPane (Display *foo, XMenu *menu, char *txt, int enable) | |||
| 3347 | menu->submenu[menu->count] = IT_menu_create (); | 3356 | menu->submenu[menu->count] = IT_menu_create (); |
| 3348 | menu->text[menu->count] = txt; | 3357 | menu->text[menu->count] = txt; |
| 3349 | menu->panenumber[menu->count] = ++menu->panecount; | 3358 | menu->panenumber[menu->count] = ++menu->panecount; |
| 3359 | menu->help_text[menu->count] = NULL; | ||
| 3350 | menu->count++; | 3360 | menu->count++; |
| 3351 | 3361 | ||
| 3352 | /* Adjust length for possible control characters (which will | 3362 | /* Adjust length for possible control characters (which will |
| @@ -3365,7 +3375,7 @@ XMenuAddPane (Display *foo, XMenu *menu, char *txt, int enable) | |||
| 3365 | 3375 | ||
| 3366 | int | 3376 | int |
| 3367 | XMenuAddSelection (Display *bar, XMenu *menu, int pane, | 3377 | XMenuAddSelection (Display *bar, XMenu *menu, int pane, |
| 3368 | int foo, char *txt, int enable) | 3378 | int foo, char *txt, int enable, char *help_text) |
| 3369 | { | 3379 | { |
| 3370 | int len; | 3380 | int len; |
| 3371 | char *p; | 3381 | char *p; |
| @@ -3377,6 +3387,7 @@ XMenuAddSelection (Display *bar, XMenu *menu, int pane, | |||
| 3377 | menu->submenu[menu->count] = (XMenu *) 0; | 3387 | menu->submenu[menu->count] = (XMenu *) 0; |
| 3378 | menu->text[menu->count] = txt; | 3388 | menu->text[menu->count] = txt; |
| 3379 | menu->panenumber[menu->count] = enable; | 3389 | menu->panenumber[menu->count] = enable; |
| 3390 | menu->help_text[menu->count] = help_text; | ||
| 3380 | menu->count++; | 3391 | menu->count++; |
| 3381 | 3392 | ||
| 3382 | /* Adjust length for possible control characters (which will | 3393 | /* Adjust length for possible control characters (which will |
| @@ -3416,7 +3427,8 @@ struct IT_menu_state | |||
| 3416 | 3427 | ||
| 3417 | int | 3428 | int |
| 3418 | XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, | 3429 | XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, |
| 3419 | int x0, int y0, unsigned ButtonMask, char **txt) | 3430 | int x0, int y0, unsigned ButtonMask, char **txt, |
| 3431 | void (*help_callback)(char *)) | ||
| 3420 | { | 3432 | { |
| 3421 | struct IT_menu_state *state; | 3433 | struct IT_menu_state *state; |
| 3422 | int statecount; | 3434 | int statecount; |
| @@ -3483,7 +3495,8 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, | |||
| 3483 | panes, which is ugly. */ | 3495 | panes, which is ugly. */ |
| 3484 | IT_display_cursor (0); | 3496 | IT_display_cursor (0); |
| 3485 | 3497 | ||
| 3486 | IT_menu_display (menu, y0 - 1, x0 - 1, title_faces); /* display menu title */ | 3498 | /* Display the menu title. */ |
| 3499 | IT_menu_display (menu, y0 - 1, x0 - 1, title_faces, 0); | ||
| 3487 | if (buffers_num_deleted) | 3500 | if (buffers_num_deleted) |
| 3488 | menu->text[0][7] = ' '; | 3501 | menu->text[0][7] = ' '; |
| 3489 | if ((onepane = menu->count == 1 && menu->submenu[0])) | 3502 | if ((onepane = menu->count == 1 && menu->submenu[0])) |
| @@ -3542,7 +3555,7 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, | |||
| 3542 | IT_menu_display (state[i].menu, | 3555 | IT_menu_display (state[i].menu, |
| 3543 | state[i].y, | 3556 | state[i].y, |
| 3544 | state[i].x, | 3557 | state[i].x, |
| 3545 | faces); | 3558 | faces, 1); |
| 3546 | state[statecount].menu = state[i].menu->submenu[dy]; | 3559 | state[statecount].menu = state[i].menu->submenu[dy]; |
| 3547 | state[statecount].pane = state[i].menu->panenumber[dy]; | 3560 | state[statecount].pane = state[i].menu->panenumber[dy]; |
| 3548 | mouse_off (); | 3561 | mouse_off (); |
| @@ -3558,12 +3571,20 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, | |||
| 3558 | IT_menu_display (state[statecount - 1].menu, | 3571 | IT_menu_display (state[statecount - 1].menu, |
| 3559 | state[statecount - 1].y, | 3572 | state[statecount - 1].y, |
| 3560 | state[statecount - 1].x, | 3573 | state[statecount - 1].x, |
| 3561 | faces); | 3574 | faces, 1); |
| 3562 | } | 3575 | } |
| 3563 | else | 3576 | else |
| 3564 | /* We are busy-waiting for the mouse to move, so let's be nice | 3577 | { |
| 3565 | to other Windows applications by releasing our time slice. */ | 3578 | if ((menu_help_message || prev_menu_help_message) |
| 3566 | __dpmi_yield (); | 3579 | && menu_help_message != prev_menu_help_message) |
| 3580 | { | ||
| 3581 | help_callback (menu_help_message); | ||
| 3582 | prev_menu_help_message = menu_help_message; | ||
| 3583 | } | ||
| 3584 | /* We are busy-waiting for the mouse to move, so let's be nice | ||
| 3585 | to other Windows applications by releasing our time slice. */ | ||
| 3586 | __dpmi_yield (); | ||
| 3587 | } | ||
| 3567 | for (b = 0; b < mouse_button_count && !leave; b++) | 3588 | for (b = 0; b < mouse_button_count && !leave; b++) |
| 3568 | { | 3589 | { |
| 3569 | /* Only leave if user both pressed and released the mouse, and in | 3590 | /* Only leave if user both pressed and released the mouse, and in |
| @@ -3583,6 +3604,7 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, | |||
| 3583 | ScreenUpdate (state[0].screen_behind); | 3604 | ScreenUpdate (state[0].screen_behind); |
| 3584 | if (screen_virtual_segment) | 3605 | if (screen_virtual_segment) |
| 3585 | dosv_refresh_virtual_screen (0, screen_size); | 3606 | dosv_refresh_virtual_screen (0, screen_size); |
| 3607 | message (0); | ||
| 3586 | while (statecount--) | 3608 | while (statecount--) |
| 3587 | xfree (state[statecount].screen_behind); | 3609 | xfree (state[statecount].screen_behind); |
| 3588 | IT_display_cursor (1); /* turn cursor back on */ | 3610 | IT_display_cursor (1); /* turn cursor back on */ |
| @@ -3611,8 +3633,10 @@ XMenuDestroy (Display *foo, XMenu *menu) | |||
| 3611 | xfree (menu->text); | 3633 | xfree (menu->text); |
| 3612 | xfree (menu->submenu); | 3634 | xfree (menu->submenu); |
| 3613 | xfree (menu->panenumber); | 3635 | xfree (menu->panenumber); |
| 3636 | xfree (menu->help_text); | ||
| 3614 | } | 3637 | } |
| 3615 | xfree (menu); | 3638 | xfree (menu); |
| 3639 | menu_help_message = prev_menu_help_message = NULL; | ||
| 3616 | } | 3640 | } |
| 3617 | 3641 | ||
| 3618 | int | 3642 | int |