aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2007-01-14 07:58:02 +0000
committerYAMAMOTO Mitsuharu2007-01-14 07:58:02 +0000
commit28c96b4d924055b20ca2fe827118f9a13224eed0 (patch)
tree95194ef2013d937fac972b112350f4657541e0cc /src
parentde529e210ce8519617bf371f39c677bc974e7d67 (diff)
downloademacs-28c96b4d924055b20ca2fe827118f9a13224eed0.tar.gz
emacs-28c96b4d924055b20ca2fe827118f9a13224eed0.zip
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
DisableControl for disabled items. Set default button to first enabled one. Use icon of application in execution.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/macmenu.c47
2 files changed, 42 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3842c3c5824..f30f2a66572 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12007-01-14 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2
3 * macmenu.c [TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
4 DisableControl for disabled items. Set default button to first
5 enabled one. Use icon of application in execution.
6
12007-01-13 Eli Zaretskii <eliz@gnu.org> 72007-01-13 Eli Zaretskii <eliz@gnu.org>
2 8
3 * process.c (Fdelete_process, Fprocess_id, sigchld_handler): Copy 9 * process.c (Fdelete_process, Fprocess_id, sigchld_handler): Copy
diff --git a/src/macmenu.c b/src/macmenu.c
index 34e38eb2f47..b412429d696 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -2447,7 +2447,7 @@ create_and_show_dialog (f, first_wv)
2447 short buttons_height, text_height, inner_width, inner_height; 2447 short buttons_height, text_height, inner_width, inner_height;
2448 Rect empty_rect, *rects; 2448 Rect empty_rect, *rects;
2449 WindowRef window = NULL; 2449 WindowRef window = NULL;
2450 ControlRef *buttons, text; 2450 ControlRef *buttons, default_button = NULL, text;
2451 2451
2452 dialog_name = first_wv->name; 2452 dialog_name = first_wv->name;
2453 nb_buttons = dialog_name[1] - '0'; 2453 nb_buttons = dialog_name[1] - '0';
@@ -2490,6 +2490,13 @@ create_and_show_dialog (f, first_wv)
2490 } 2490 }
2491 if (err == noErr) 2491 if (err == noErr)
2492 { 2492 {
2493 if (!wv->enabled)
2494 err = DisableControl (buttons[i]);
2495 else if (default_button == NULL)
2496 default_button = buttons[i];
2497 }
2498 if (err == noErr)
2499 {
2493 SInt16 unused; 2500 SInt16 unused;
2494 2501
2495 rects[i] = empty_rect; 2502 rects[i] = empty_rect;
@@ -2617,30 +2624,48 @@ create_and_show_dialog (f, first_wv)
2617 /* Create the application icon at the upper-left corner. */ 2624 /* Create the application icon at the upper-left corner. */
2618 if (err == noErr) 2625 if (err == noErr)
2619 { 2626 {
2620 ControlButtonContentInfo button_info; 2627 ControlButtonContentInfo content;
2621 IconRef icon_ref;
2622 ControlRef icon; 2628 ControlRef icon;
2629 static const ProcessSerialNumber psn = {0, kCurrentProcess};
2630#ifdef MAC_OSX
2631 FSRef app_location;
2632#else
2633 ProcessInfoRec pinfo;
2634 FSSpec app_spec;
2635#endif
2636 SInt16 unused;
2623 2637
2624 button_info.contentType = kControlContentIconRef; 2638 content.contentType = kControlContentIconRef;
2625 err = GetIconRef (kOnAppropriateDisk, MAC_EMACS_CREATOR_CODE, 2639#ifdef MAC_OSX
2626 kGenericApplicationIcon, &icon_ref); 2640 err = GetProcessBundleLocation (&psn, &app_location);
2641 if (err == noErr)
2642 err = GetIconRefFromFileInfo (&app_location, 0, NULL, 0, NULL,
2643 kIconServicesNormalUsageFlag,
2644 &content.u.iconRef, &unused);
2645#else
2646 bzero (&pinfo, sizeof (ProcessInfoRec));
2647 pinfo.processInfoLength = sizeof (ProcessInfoRec);
2648 pinfo.processAppSpec = &app_spec;
2649 err = GetProcessInformation (&psn, &pinfo);
2650 if (err == noErr)
2651 err = GetIconRefFromFile (&app_spec, &content.u.iconRef, &unused);
2652#endif
2627 if (err == noErr) 2653 if (err == noErr)
2628 { 2654 {
2629 Rect bounds; 2655 Rect bounds;
2630 2656
2631 button_info.u.iconRef = icon_ref;
2632 SetRect (&bounds, DIALOG_ICON_LEFT_MARGIN, DIALOG_ICON_TOP_MARGIN, 2657 SetRect (&bounds, DIALOG_ICON_LEFT_MARGIN, DIALOG_ICON_TOP_MARGIN,
2633 DIALOG_ICON_LEFT_MARGIN + DIALOG_ICON_WIDTH, 2658 DIALOG_ICON_LEFT_MARGIN + DIALOG_ICON_WIDTH,
2634 DIALOG_ICON_TOP_MARGIN + DIALOG_ICON_HEIGHT); 2659 DIALOG_ICON_TOP_MARGIN + DIALOG_ICON_HEIGHT);
2635 err = CreateIconControl (window, &bounds, &button_info, 2660 err = CreateIconControl (window, &bounds, &content, true, &icon);
2636 true, &icon); 2661 ReleaseIconRef (content.u.iconRef);
2637 ReleaseIconRef (icon_ref);
2638 } 2662 }
2639 } 2663 }
2640 2664
2641 /* Show the dialog window and run event loop. */ 2665 /* Show the dialog window and run event loop. */
2642 if (err == noErr) 2666 if (err == noErr)
2643 err = SetWindowDefaultButton (window, buttons[0]); 2667 if (default_button)
2668 err = SetWindowDefaultButton (window, default_button);
2644 if (err == noErr) 2669 if (err == noErr)
2645 err = install_dialog_event_handler (window); 2670 err = install_dialog_event_handler (window);
2646 if (err == noErr) 2671 if (err == noErr)