diff src/xmenu.c @ 40477:a56267e601e4

Include coding.h and charset.h. (Fx_popup_menu): Use FRAME_PTR and FRAME_FONT and FRAME_LINE_HEIGHT. (Fx_popup_dialog): Use FRAME_PTR and enum scroll_bar_part. (single_submenu, xmenu_show): Use ENCODE_SYSTEM. Explicitly set wv->help. Use `TRUE' rather than `True'. (menu_help_callback): Use empty_string.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 30 Oct 2001 03:44:08 +0000
parents 5fda2888718a
children cdfd4d09b79a
line wrap: on
line diff
--- a/src/xmenu.c	Tue Oct 30 03:38:24 2001 +0000
+++ b/src/xmenu.c	Tue Oct 30 03:44:08 2001 +0000
@@ -46,6 +46,8 @@
 #include "window.h"
 #include "blockinput.h"
 #include "buffer.h"
+#include "charset.h"
+#include "coding.h"
 
 #ifdef MSDOS
 #include "msdos.h"
@@ -111,9 +113,6 @@
 
 static Lisp_Object xdialog_show ();
 void popup_get_selection ();
-#endif
-
-#ifdef USE_X_TOOLKIT
 
 /* Define HAVE_BOXES if menus can handle radio and toggle buttons.  */
 
@@ -697,7 +696,7 @@
   Lisp_Object title;
   char *error_name;
   Lisp_Object selection;
-  struct frame *f = NULL;
+  FRAME_PTR f = NULL;
   Lisp_Object x, y, window;
   int keymaps = 0;
   int for_click = 0;
@@ -767,9 +766,9 @@
 	  CHECK_LIVE_WINDOW (window, 0);
 	  f = XFRAME (WINDOW_FRAME (XWINDOW (window)));
 
-	  xpos = (FONT_WIDTH (f->output_data.x->font)
+	  xpos = (FONT_WIDTH (FRAME_FONT (f))
 		  * XFASTINT (XWINDOW (window)->left));
-	  ypos = (f->output_data.x->line_height
+	  ypos = (FRAME_LINE_HEIGHT (f)
 		  * XFASTINT (XWINDOW (window)->top));
 	}
       else
@@ -899,7 +898,7 @@
      (position, contents)
      Lisp_Object position, contents;
 {
-  struct frame * f = NULL;
+  FRAME_PTR f = NULL;
   Lisp_Object window;
 
   check_x ();
@@ -913,7 +912,7 @@
       /* Use the mouse's current position.  */
       FRAME_PTR new_f = SELECTED_FRAME ();
       Lisp_Object bar_window;
-      int part;
+      enum scroll_bar_part part;
       unsigned long time;
       Lisp_Object x, y;
 
@@ -1449,7 +1448,7 @@
 #ifndef HAVE_MULTILINGUAL_MENU
 	  if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
 	    {
-	      pane_name = string_make_unibyte (pane_name);
+	      pane_name = ENCODE_SYSTEM (pane_name);
 	      AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name;
 	    }
 #endif
@@ -1500,13 +1499,13 @@
 #ifndef HAVE_MULTILINGUAL_MENU
           if (STRING_MULTIBYTE (item_name))
 	    {
-	      item_name = string_make_unibyte (item_name);
+	      item_name = ENCODE_SYSTEM (item_name);
 	      AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
 	    }
 	  
           if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
 	    {
-	      descrip = string_make_unibyte (descrip);
+	      descrip = ENCODE_SYSTEM (descrip);
 	      AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
 	    }
 #endif /* not HAVE_MULTILINGUAL_MENU */
@@ -1537,8 +1536,10 @@
 
 	  wv->selected = !NILP (selected);
 	  if (STRINGP (help))
-	    wv->help = XSTRING (help)->data;
-		   
+	    wv->help = (char *) XSTRING (help)->data;
+          else
+            wv->help = NULL;
+
 	  prev_wv = wv;
 
 	  i += MENU_ITEMS_ITEM_LENGTH;
@@ -1617,6 +1618,7 @@
   Lisp_Object items;
   widget_value *wv, *first_wv, *prev_wv = 0;
   int i;
+
   LWLIB_ID id;
 
   XSETFRAME (Vmenu_updating_frame, f);
@@ -2040,7 +2042,7 @@
 #ifndef HAVE_MULTILINGUAL_MENU
 	  if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
 	    {
-	      pane_name = string_make_unibyte (pane_name);
+	      pane_name = ENCODE_SYSTEM (pane_name);
 	      AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name;
 	    }
 #endif
@@ -2093,13 +2095,13 @@
 #ifndef HAVE_MULTILINGUAL_MENU
           if (STRINGP (item_name) && STRING_MULTIBYTE (item_name))
 	    {
-	      item_name = string_make_unibyte (item_name);
+	      item_name = ENCODE_SYSTEM (item_name);
 	      AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
 	    }
 	  
           if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
 	    {
-	      descrip = string_make_unibyte (descrip);
+	      descrip = ENCODE_SYSTEM (descrip);
 	      AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
 	    }
 #endif /* not HAVE_MULTILINGUAL_MENU */
@@ -2130,9 +2132,12 @@
 	    abort ();
 
 	  wv->selected = !NILP (selected);
-	  if (STRINGP (help))
-	    wv->help = XSTRING (help)->data;
-	  
+
+          if (STRINGP (help))
+            wv->help = (char *) XSTRING (help)->data;
+          else
+            wv->help = NULL;
+
 	  prev_wv = wv;
 
 	  i += MENU_ITEMS_ITEM_LENGTH;
@@ -2154,11 +2159,11 @@
 
 #ifndef HAVE_MULTILINGUAL_MENU
       if (STRING_MULTIBYTE (title))
-	title = string_make_unibyte (title);
+	title = ENCODE_SYSTEM (title);
 #endif
       
       wv_title->name = (char *) XSTRING (title)->data;
-      wv_title->enabled = True;
+      wv_title->enabled = TRUE;
       wv_title->button_type = BUTTON_TYPE_NONE;
       wv_title->next = wv_sep1;
       first_wv->contents = wv_title;
@@ -2538,7 +2543,7 @@
     pane_name = first_item[MENU_ITEMS_PANE_NAME];
   else if (EQ (first_item[0], Qquote))
     /* This shouldn't happen, see xmenu_show.  */
-    pane_name = build_string ("");
+    pane_name = empty_string;
   else
     pane_name = first_item[MENU_ITEMS_ITEM_NAME];