changeset 5715:68f8d295be49

Support :visible in menu specifications.
author Jerry James <james@xemacs.org>
date Wed, 23 Jan 2013 11:48:46 -0700
parents 489e76b85828
children 1003acd5a4b8
files lisp/ChangeLog lisp/glyphs.el lisp/menubar.el man/ChangeLog man/lispref/glyphs.texi man/lispref/menus.texi src/ChangeLog src/general-slots.h src/gui.c src/menubar-gtk.c src/menubar-x.c src/menubar.c
diffstat 12 files changed, 45 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Jan 21 10:17:55 2013 -0700
+++ b/lisp/ChangeLog	Wed Jan 23 11:48:46 2013 -0700
@@ -1,3 +1,9 @@
+2013-01-22  Jerry James  <james@xemacs.org>
+
+	* glyphs.el (make-image-specifier): Document that :visible is a
+	widget keyword.
+	* menubar.el (check-menu-syntax): Allow :visible in menu specs.
+
 2013-01-04  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* XEmacs 21.5.33 "horseradish" is released.
--- a/lisp/glyphs.el	Mon Jan 21 10:17:55 2013 -0700
+++ b/lisp/glyphs.el	Wed Jan 23 11:48:46 2013 -0700
@@ -266,7 +266,7 @@
 \[WIDGET-KEYWORDS] stands for the standard keywords accepted by widgets:
 These are `:selected', `:active', `:suffix', `:keys', `:style',
 `:filter', `:config', `:included', `:key-sequence', `:accelerator',
-`:label', `:callback', `:initial-focus', and `:descriptor'.
+`:label', `:callback', `:initial-focus', `:descriptor', and `:visible'.
 #### Document me.
 
 \[GUI-KEYWORDS] stands for keywords accepted by many widgets.
--- a/lisp/menubar.el	Mon Jan 21 10:17:55 2013 -0700
+++ b/lisp/menubar.el	Wed Jan 23 11:48:46 2013 -0700
@@ -79,9 +79,9 @@
     (setq menu (cdr menu)))
   (let (menuitem item)
     (while (keywordp (setq item (car menu)))
-      (or (memq item '(:config :included :filter :accelerator :active))
+      (or (memq item '(:config :included :visible :filter :accelerator :active))
 	  (signal 'error
-		  (list "menu keyword must be :config, :included, :accelerator, :active or :filter"
+		  (list "menu keyword must be :config, :included, :visible, :accelerator, :active or :filter"
 			item)))
       (if (or (not (cdr menu))
 	      (vectorp (nth 1 menu))
@@ -135,7 +135,7 @@
 		  (setq item (aref menuitem i))
 		  (cond ((not (memq item '(:active :suffix :keys :style
 						   :full :included :selected
-						   :accelerator)))
+						   :visible :accelerator)))
 			 (signal 'error
 				 (list (if (keywordp item)
 					   "unknown menu item keyword"
--- a/man/ChangeLog	Mon Jan 21 10:17:55 2013 -0700
+++ b/man/ChangeLog	Wed Jan 23 11:48:46 2013 -0700
@@ -1,3 +1,10 @@
+2013-01-22  Jerry James  <james@xemacs.org>
+
+	* lispref/glyphs.texi (Image Instantiators): Add :visible to the
+	list of allowed menu keywords.
+	* lispref/menus.tex (Menu Format): Document that :visible is an
+	alias for :included.
+
 2013-01-04  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* XEmacs 21.5.33 "horseradish" is released.
--- a/man/lispref/glyphs.texi	Mon Jan 21 10:17:55 2013 -0700
+++ b/man/lispref/glyphs.texi	Wed Jan 23 11:48:46 2013 -0700
@@ -299,6 +299,7 @@
 @itemx :filter
 @itemx :config
 @itemx :included
+@itemx :visible
 @itemx :key-sequence
 @itemx :accelerator
 @itemx :label
--- a/man/lispref/menus.texi	Mon Jan 21 10:17:55 2013 -0700
+++ b/man/lispref/menus.texi	Wed Jan 23 11:48:46 2013 -0700
@@ -45,6 +45,7 @@
 @item :included @var{form}
 This can be used to control the visibility of a menu.  The form is
 evaluated and the menu will be omitted if the result is @code{nil}.
+The keyword @code{:visible} is an alias for @code{:included}.
 
 @item :config @var{symbol}
 This is an efficient shorthand for @code{:included (memq @var{symbol}
@@ -224,7 +225,8 @@
 non-@code{nil}.  Note that this is different from @code{:active}: If
 @code{:active} evaluates to @code{nil}, the item will be displayed
 grayed out, while if @code{:included} evaluates to @code{nil}, the item
-will be omitted entirely.
+will be omitted entirely.  The keyword @code{:visible} is an alias for
+@code{:included}.
 
 @item :config @var{symbol}
 This is an efficient shorthand for @code{:included (memq @var{symbol}
--- a/src/ChangeLog	Mon Jan 21 10:17:55 2013 -0700
+++ b/src/ChangeLog	Wed Jan 23 11:48:46 2013 -0700
@@ -1,3 +1,13 @@
+2013-01-22  Jerry James  <james@xemacs.org>
+
+	* general-slots.h: Add Q_visible.
+	* gui.c (gui_item_add_keyval_pair): Add :visible as an alias to
+	:included.
+	* menubar.c (vars_of_menubar): Document that :visible is an alias
+	to :included.
+	* menubar-gtk.c (menu_convert): Ditto.
+	* menubar-x.c (menu_item_descriptor_to_widget_value_1): Ditto.
+
 2013-01-16  Jerry James  <james@xemacs.org>
 
 	* menubar-x.c (set_frame_menubar): when a menubar specification has an
--- a/src/general-slots.h	Mon Jan 21 10:17:55 2013 -0700
+++ b/src/general-slots.h	Wed Jan 23 11:48:46 2013 -0700
@@ -312,6 +312,7 @@
 SYMBOL_KEYWORD (Q_value);
 SYMBOL (Qvalue_assoc);
 SYMBOL (Qvertical);
+SYMBOL_KEYWORD (Q_visible);
 SYMBOL (Qwarning);
 SYMBOL (Qwidget);
 SYMBOL (Qwidth);
--- a/src/gui.c	Mon Jan 21 10:17:55 2013 -0700
+++ b/src/gui.c	Wed Jan 23 11:48:46 2013 -0700
@@ -144,7 +144,6 @@
   }
   FROB (suffix)
   FROB (active)
-  FROB (included)
   FROB (config)
   FROB (filter)
   FROB (style)
@@ -154,6 +153,14 @@
   FROB (callback_ex)
   FROB (value)
 #undef FROB
+  else if (EQ (key, Q_included) || EQ (key, Q_visible))
+    {
+      if (!EQ (pgui_item->included, val))
+	{
+	  retval = 1;
+	  pgui_item->included = val;
+	}
+    }
   else if (EQ (key, Q_key_sequence)) ;   /* ignored for FSF compatibility */
   else if (EQ (key, Q_label)) ;   /* ignored for 21.0 implement in 21.2  */
   else if (EQ (key, Q_accelerator))
--- a/src/menubar-gtk.c	Mon Jan 21 10:17:55 2013 -0700
+++ b/src/menubar-gtk.c	Wed Jan 23 11:48:46 2013 -0700
@@ -631,7 +631,7 @@
 				 cascade);
 	  val = Fcar (desc);
 	  desc = Fcdr (desc);
-	  if (EQ (key, Q_included))
+	  if (EQ (key, Q_included) || EQ(key, Q_visible))
 	    include_p = val, included_spec = 1;
 	  else if (EQ (key, Q_config))
 	    config_tag = val;
--- a/src/menubar-x.c	Mon Jan 21 10:17:55 2013 -0700
+++ b/src/menubar-x.c	Wed Jan 23 11:48:46 2013 -0700
@@ -172,7 +172,7 @@
 		sferror ("Keyword in menu lacks a value", cascade);
 	      val = Fcar (desc);
 	      desc = Fcdr (desc);
-	      if (EQ (key, Q_included))
+	      if (EQ (key, Q_included) || EQ (key, Q_visible))
 		include_p = val, included_spec = 1;
 	      else if (EQ (key, Q_config))
 		config_tag = val;
--- a/src/menubar.c	Mon Jan 21 10:17:55 2013 -0700
+++ b/src/menubar.c	Wed Jan 23 11:48:46 2013 -0700
@@ -495,7 +495,7 @@
 
 Immediately following the name string of the menu, various optional
 keyword-value pairs are permitted: currently, :filter, :active, :included,
-and :config. (See below.)
+:visible, and :config. (See below.)
 
 If an element of a menu (or menubar) is a string, then that string will be
 presented as unselectable text.
@@ -597,7 +597,8 @@
 
  :included <form>    This can be used to control the visibility of a menu or
 		     menu item.  The form is evaluated and the menu or menu
-		     item is only displayed if the result is non-nil.
+		     item is only displayed if the result is non-nil.  The
+		     keyword :visible is an alias for :included.
 
  :config  <symbol>   This is an efficient shorthand for
 		         :included (memq symbol menubar-configuration)