emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r102450: Add keyword :vert-only for t


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102450: Add keyword :vert-only for tool bar items with labels not shown horizontally.
Date: Sat, 20 Nov 2010 15:51:25 +0100
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102450
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Sat 2010-11-20 15:51:25 +0100
message:
  Add keyword :vert-only for tool bar items with labels not shown horizontally.
  
  * lisp/info.el (info-tool-bar-map): Add some :vert-only keywords.
  
  * lisp/tool-bar.el (tool-bar-setup): Add some :vert-only keywords.
  
  * src/dispextern.h (tool_bar_item_idx): Add TOOL_BAR_ITEM_VERT_ONLY.
  
  * src/gtkutil.c (xg_make_tool_item): Take vert_only as argument.
  Set important to ! vert_only.
  (xg_show_toolbar_item): Don't show label horizontally if
  tool item isn't important.
  (update_frame_tool_bar): Get TOOL_BAR_ITEM_VERT_ONLY and pass it to
  xg_make_tool_item, or update important on existing tool item.
  
  * src/keyboard.c (QCvert_only): New variable.
  (parse_tool_bar_item): Check for QCvert_only.
  (syms_of_keyboard): Initialize QCvert_only.
modified:
  lisp/ChangeLog
  lisp/info.el
  lisp/tool-bar.el
  src/ChangeLog
  src/dispextern.h
  src/gtkutil.c
  src/keyboard.c
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-11-20 14:35:45 +0000
+++ b/lisp/ChangeLog    2010-11-20 14:51:25 +0000
@@ -1,3 +1,9 @@
+2010-11-20  Jan Djärv  <address@hidden>
+
+       * tool-bar.el (tool-bar-setup): Add some :vert-only keywords.
+
+       * info.el (info-tool-bar-map): Add some :vert-only keywords.
+
 2010-11-20  Eli Zaretskii  <address@hidden>
 
        * international/characters.el (glyphless-char-display-control):

=== modified file 'lisp/info.el'
--- a/lisp/info.el      2010-11-09 05:33:07 +0000
+++ b/lisp/info.el      2010-11-20 14:51:25 +0000
@@ -3763,15 +3763,18 @@
   (let ((map (make-sparse-keymap)))
     (tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map 
Info-mode-map
                                   :rtl "right-arrow"
-                                  :label "Back")
+                                  :label "Back"
+                                  :vert-only t)
     (tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map 
Info-mode-map
                                   :rtl "left-arrow"
-                                  :label "Forward")
+                                  :label "Forward"
+                                  :vert-only t)
     (tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map
                                   :rtl "next-node")
     (tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map
                                   :rtl "prev-node")
-    (tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map)
+    (tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map
+                                  :vert-only t)
     (tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map)
     (tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map)
     (tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map

=== modified file 'lisp/tool-bar.el'
--- a/lisp/tool-bar.el  2010-10-29 03:29:29 +0000
+++ b/lisp/tool-bar.el  2010-11-20 14:51:25 +0000
@@ -260,31 +260,33 @@
   ;; People say it's bad to have EXIT on the tool bar, since users
   ;; might inadvertently click that button.
   ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit")
-  (tool-bar-add-item-from-menu 'find-file "new" nil :label "New File")
-  (tool-bar-add-item-from-menu 'menu-find-file-existing "open")
-  (tool-bar-add-item-from-menu 'dired "diropen")
-  (tool-bar-add-item-from-menu 'kill-this-buffer "close")
-  (tool-bar-add-item-from-menu 'save-buffer "save" nil
-                              :visible '(or buffer-file-name
-                                            (not (eq 'special
-                                                     (get major-mode
-                                                          'mode-class)))))
-  (tool-bar-add-item-from-menu 'write-file "saveas" nil
-                              :visible '(or buffer-file-name
-                                            (not (eq 'special
-                                                     (get major-mode
-                                                          'mode-class)))))
-  (tool-bar-add-item-from-menu 'undo "undo" nil
+  (tool-bar-add-item-from-menu 'find-file "new" nil :label "New File"
+                              :vert-only t)
+  (tool-bar-add-item-from-menu 'menu-find-file-existing "open" nil
+                              :vert-only t)
+  (tool-bar-add-item-from-menu 'dired "diropen" nil :vert-only t)
+  (tool-bar-add-item-from-menu 'kill-this-buffer "close" nil :vert-only t)
+  (tool-bar-add-item-from-menu 'save-buffer "save" nil :vert-only t
+                              :visible '(or buffer-file-name
+                                            (not (eq 'special
+                                                     (get major-mode
+                                                          'mode-class)))))
+  (tool-bar-add-item-from-menu 'write-file "saveas" nil :vert-only t
+                              :visible '(or buffer-file-name
+                                            (not (eq 'special
+                                                     (get major-mode
+                                                          'mode-class)))))
+  (tool-bar-add-item-from-menu 'undo "undo" nil :vert-only t
                               :visible '(not (eq 'special (get major-mode
                                                                'mode-class))))
   (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [cut])
-                              "cut" nil
+                              "cut" nil :vert-only t
                               :visible '(not (eq 'special (get major-mode
                                                                'mode-class))))
   (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [copy])
-                              "copy")
+                              "copy" nil :vert-only t)
   (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [paste])
-                              "paste" nil
+                              "paste" nil :vert-only t
                               :visible '(not (eq 'special (get major-mode
                                                                'mode-class))))
   (tool-bar-add-item-from-menu 'nonincremental-search-forward "search"

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-11-20 11:45:14 +0000
+++ b/src/ChangeLog     2010-11-20 14:51:25 +0000
@@ -1,3 +1,18 @@
+2010-11-20  Jan Djärv  <address@hidden>
+
+       * gtkutil.c (xg_make_tool_item): Take vert_only as argument.
+       Set important to ! vert_only.
+       (xg_show_toolbar_item): Don't show label horizontally if
+       tool item isn't important.
+       (update_frame_tool_bar): Get TOOL_BAR_ITEM_VERT_ONLY and pass it to
+       xg_make_tool_item, or update important on existing tool item.
+
+       * keyboard.c (QCvert_only): New variable.
+       (parse_tool_bar_item): Check for QCvert_only.
+       (syms_of_keyboard): Initialize QCvert_only.
+
+       * dispextern.h (tool_bar_item_idx): Add TOOL_BAR_ITEM_VERT_ONLY.
+
 2010-11-20  Eli Zaretskii  <address@hidden>
 
        * msdos.c (dos_rawgetc): Use gen_help_event, instead of doing the

=== modified file 'src/dispextern.h'
--- a/src/dispextern.h  2010-11-20 10:07:00 +0000
+++ b/src/dispextern.h  2010-11-20 14:51:25 +0000
@@ -2887,6 +2887,9 @@
   /* Label to show when text labels are enabled.  */
   TOOL_BAR_ITEM_LABEL,
 
+  /* If we shall show the label only below the icon and not beside it.  */
+  TOOL_BAR_ITEM_VERT_ONLY,
+
   /* Sentinel = number of slots in tool_bar_items occupied by one
      tool-bar item.  */
   TOOL_BAR_ITEM_NSLOTS

=== modified file 'src/gtkutil.c'
--- a/src/gtkutil.c     2010-10-26 06:09:54 +0000
+++ b/src/gtkutil.c     2010-11-20 14:51:25 +0000
@@ -4059,7 +4059,8 @@
                    GtkWidget *wimage,
                    GtkWidget **wbutton,
                    const char *label,
-                   int i)
+                   int i,
+                   int vert_only)
 {
   GtkToolItem *ti = gtk_tool_item_new ();
   Lisp_Object style = Ftool_bar_get_system_style ();
@@ -4071,6 +4072,10 @@
   GtkWidget *wb = gtk_button_new ();
   GtkWidget *weventbox = gtk_event_box_new ();
 
+  /* We are not letting Gtk+ alter display on this, we only keep it here
+     so we can get it later in xg_show_toolbar_item.  */
+  gtk_tool_item_set_is_important (ti, !vert_only);
+
   if (wimage && ! text_image)
     gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0);
 
@@ -4144,7 +4149,8 @@
   int text_image = EQ (style, Qtext_image_horiz);
 
   int horiz = both_horiz || text_image;
-  int show_label = ! EQ (style, Qimage);
+  int vert_only = ! gtk_tool_item_get_is_important (ti);
+  int show_label = ! EQ (style, Qimage) && ! (vert_only && horiz);
   int show_image = ! EQ (style, Qtext);
 
   GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti));
@@ -4301,7 +4307,8 @@
       Lisp_Object specified_file;
       const char *label = (STRINGP (PROP (TOOL_BAR_ITEM_LABEL))
                            ? SSDATA (PROP (TOOL_BAR_ITEM_LABEL)) : "");
-      
+      int vert_only = ! NILP (PROP (TOOL_BAR_ITEM_VERT_ONLY));
+
       ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i);
 
       if (ti)
@@ -4391,7 +4398,7 @@
               else
                 {
                   /* Insert an empty (non-image) button */
-                  ti = xg_make_tool_item (f, NULL, NULL, "", i);
+                  ti = xg_make_tool_item (f, NULL, NULL, "", i, 0);
                   gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1);
                 }
               continue;
@@ -4425,7 +4432,7 @@
             }
 
           gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin);
-          ti = xg_make_tool_item (f, w, &wbutton, label, i);
+          ti = xg_make_tool_item (f, w, &wbutton, label, i, vert_only);
           gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1);
           gtk_widget_set_sensitive (wbutton, enabled_p);
         }
@@ -4442,6 +4449,7 @@
           gpointer old_icon_name = g_object_get_data (G_OBJECT (wimage),
                                                       XG_TOOL_BAR_ICON_NAME);
           gtk_label_set_text (GTK_LABEL (wlbl), label);
+          gtk_tool_item_set_is_important (ti, !vert_only);
           if (stock_name &&
               (! old_stock_name || strcmp (old_stock_name, stock_name) != 0))
             {

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2010-11-18 16:57:00 +0000
+++ b/src/keyboard.c    2010-11-20 14:51:25 +0000
@@ -489,10 +489,10 @@
 Lisp_Object Qevent_kind;
 Lisp_Object Qevent_symbol_elements;
 
-/* menu item parts */
+/* menu and tool bar item parts */
 Lisp_Object Qmenu_enable;
 Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence;
-Lisp_Object QCbutton, QCtoggle, QCradio, QClabel;
+Lisp_Object QCbutton, QCtoggle, QCradio, QClabel, QCvert_only;
 
 /* An event header symbol HEAD may have a property named
    Qevent_symbol_element_mask, which is of the form (BASE MODIFIERS);
@@ -8269,9 +8269,12 @@
          if (NILP (menu_item_eval_property (value)))
            return 0;
        }
-      else if (EQ (key, QChelp))
+      else if (EQ (key, QChelp)) 
         /* `:help HELP-STRING'.  */
         PROP (TOOL_BAR_ITEM_HELP) = value;
+      else if (EQ (key, QCvert_only)) 
+        /* `:vert-only t/nil'.  */
+        PROP (TOOL_BAR_ITEM_VERT_ONLY) = value;
       else if (EQ (key, QClabel))
         {
           const char *bad_label = "!!?GARBLED ITEM?!!";
@@ -11629,6 +11632,8 @@
   staticpro (&QCradio);
   QClabel = intern_c_string (":label");
   staticpro (&QClabel);
+  QCvert_only = intern_c_string (":vert-only");
+  staticpro (&QCvert_only);
 
   Qmode_line = intern_c_string ("mode-line");
   staticpro (&Qmode_line);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]