all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* tool-bar (Carbon port): labels under icons
@ 2008-04-05  7:50 David Reitter
  2008-04-05  8:10 ` Jan Djärv
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: David Reitter @ 2008-04-05  7:50 UTC (permalink / raw)
  To: emacs- devel

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]

Can I suggest the following patch that allows the use of labels under  
the icons as is standard on the OS?


2008-04-05  David Reitter <david.reitter@gmail.com>

	* tool-bar.el (tool-bar-local-item): Accept string for KEY
	as icon label.
	(tool-bar-setup): Use readable strings for labels.
	

2008-04-05  David Reitter <david.reitter@gmail.com>

	* macterm.c [USE_MAC_TOOLBAR]: Add Vmac_tool_bar_display_mode.
	(update_frame_tool_bar) [USE_MAC_TOOLBAR]: set display mode.




[-- Attachment #2: tool-bar-display-mode.patch --]
[-- Type: application/octet-stream, Size: 4195 bytes --]

Index: src/macterm.c
===================================================================
RCS file: /sources/emacs/emacs/src/macterm.c,v
retrieving revision 1.214.2.16
diff -c -r1.214.2.16 macterm.c
*** src/macterm.c	29 Mar 2008 00:46:51 -0000	1.214.2.16
--- src/macterm.c	5 Apr 2008 07:42:28 -0000
***************
*** 87,92 ****
--- 87,97 ----
  
  Lisp_Object Vx_toolkit_scroll_bars;
  
+ #if USE_MAC_TOOLBAR
+ /* Specify whether to display the tool bar as icons with labels. */
+ Lisp_Object Vmac_tool_bar_display_mode;
+ #endif
+ 
  /* If non-zero, the text will be rendered using Core Graphics text
     rendering which may anti-alias the text.  */
  int mac_use_core_graphics;
***************
*** 5955,5961 ****
      }
  
    if (err == noErr)
!     err = HIToolbarSetDisplayMode (toolbar, kHIToolbarDisplayModeIconOnly);
    if (err == noErr)
      {
        static const EventTypeSpec specs[] =
--- 5985,5991 ----
      }
  
    if (err == noErr)
!     err = HIToolbarSetDisplayMode (toolbar, kHIToolbarDisplayModeDefault);
    if (err == noErr)
      {
        static const EventTypeSpec specs[] =
*** 6099,6104 ****
--- 6130,6148 ----
    while (pos < old_count)
      HIToolbarRemoveItemAtIndex (toolbar, --old_count);
  
+   if (EQ (Vmac_tool_bar_display_mode, intern ("labels")))
+     {
+       HIToolbarSetDisplayMode (toolbar, kHIToolbarDisplayModeIconAndLabel);
+     }
+   else if (EQ (Vmac_tool_bar_display_mode, intern ("icons")))
+     {
+       HIToolbarSetDisplayMode (toolbar, kHIToolbarDisplayModeIconOnly);
+     }
+   else
+     {
+       HIToolbarSetDisplayMode (toolbar, kHIToolbarDisplayModeDefault);
+     } 
+   
    ShowHideWindowToolbar (FRAME_MAC_WINDOW (f), true,
  			 !win_gravity && f == mac_focus_frame (dpyinfo));
    /* Mac OS X 10.3 does not issue kEventWindowBoundsChanged events on
***************
*** 12984,12989 ****
--- 13028,13042 ----
  mouse-3 and the command-key will register for mouse-2.  */);
    Vmac_emulate_three_button_mouse = Qnil;
  
+ #if USE_MAC_TOOLBAR
+   DEFVAR_LISP ("mac-tool-bar-display-mode", &Vmac_tool_bar_display_mode,
+     doc: /* *Specify whether to display the tool bar as icons with labels.
+ The value can be `icons' (for icons only), `labels' (for icons with labels)
+ and nil, in which case the system default is assumed.
+ The default is nil.  */);
+   Vmac_tool_bar_display_mode = Qnil;
+ #endif
+ 
  #if TARGET_API_MAC_CARBON
    DEFVAR_BOOL ("mac-wheel-button-is-mouse-2", &mac_wheel_button_is_mouse_2,
      doc: /* *Non-nil if the wheel button is mouse-2 and the right click mouse-3.
*** lisp/tool-bar.el	05 Apr 2008 01:23:45 +0100	1.7.2.2
--- lisp/tool-bar.el	05 Apr 2008 01:24:23 +0100	
***************
*** 141,147 ****
        (unless (image-mask-p image)
  	(setq image (append image '(:mask heuristic))))
        (define-key-after map (vector key)
! 	`(menu-item ,(symbol-name key) ,def :image ,image ,@props)))))
  
  ;;;###autoload
  (defun tool-bar-add-item-from-menu (command icon &optional map &rest props)
--- 141,148 ----
        (unless (image-mask-p image)
  	(setq image (append image '(:mask heuristic))))
        (define-key-after map (vector key)
! 	`(menu-item ,(if (stringp key) key (symbol-name key))
! 		    ,def :image ,image ,@props)))))
  
  ;;;###autoload
  (defun tool-bar-add-item-from-menu (command icon &optional map &rest props)
***************
*** 273,285 ****
    ;; we must explicitly operate on the default value.
  
    (let ((tool-bar-map (default-value 'tool-bar-map)))
!     (tool-bar-add-item "preferences" 'customize 'customize
  		       :help "Edit preferences (customize)")
  
      (tool-bar-add-item "help" (lambda ()
  				(interactive)
  				(popup-menu menu-bar-help-menu))
! 		       'help
  		       :help "Pop up the Help menu"))
    )
  
--- 274,286 ----
    ;; we must explicitly operate on the default value.
  
    (let ((tool-bar-map (default-value 'tool-bar-map)))
!     (tool-bar-add-item "preferences" 'customize "Customize"
  		       :help "Edit preferences (customize)")
  
      (tool-bar-add-item "help" (lambda ()
  				(interactive)
  				(popup-menu menu-bar-help-menu))
! 		       "Help"
  		       :help "Pop up the Help menu"))
    )
  

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-04-06  1:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-05  7:50 tool-bar (Carbon port): labels under icons David Reitter
2008-04-05  8:10 ` Jan Djärv
2008-04-05  8:42   ` YAMAMOTO Mitsuharu
2008-04-05  8:40 ` YAMAMOTO Mitsuharu
2008-04-05 11:48   ` David Reitter
2008-04-05 12:33     ` YAMAMOTO Mitsuharu
2008-04-05 13:36       ` David Reitter
2008-04-05 15:40 ` Stefan Monnier
2008-04-05 22:27   ` David Reitter
2008-04-06  1:53     ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.