Commits

Anonymous committed 68f8d29

Support :visible in menu specifications.

Comments (0)

Files changed (12)

+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.
 \[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.
     (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))
 		  (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"
+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.

man/lispref/glyphs.texi

 @itemx :filter
 @itemx :config
 @itemx :included
+@itemx :visible
 @itemx :key-sequence
 @itemx :accelerator
 @itemx :label

man/lispref/menus.texi

 @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}
 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}
+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

src/general-slots.h

 SYMBOL_KEYWORD (Q_value);
 SYMBOL (Qvalue_assoc);
 SYMBOL (Qvertical);
+SYMBOL_KEYWORD (Q_visible);
 SYMBOL (Qwarning);
 SYMBOL (Qwidget);
 SYMBOL (Qwidth);
   }
   FROB (suffix)
   FROB (active)
-  FROB (included)
   FROB (config)
   FROB (filter)
   FROB (style)
   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))

src/menubar-gtk.c

 				 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;
 		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;
 
 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.
 
  :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)