Mercurial > hg > xemacs-beta
comparison src/menubar.c @ 195:a2f645c6b9f8 r20-3b24
Import from CVS: tag r20-3b24
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:59:05 +0200 |
parents | 3d6bfa290dbd |
children | acd284d43ca1 |
comparison
equal
deleted
inserted
replaced
194:2947057885e5 | 195:a2f645c6b9f8 |
---|---|
25 properly abstracted yet. */ | 25 properly abstracted yet. */ |
26 | 26 |
27 #include <config.h> | 27 #include <config.h> |
28 #include "lisp.h" | 28 #include "lisp.h" |
29 | 29 |
30 #include "buffer.h" | |
30 #include "device.h" | 31 #include "device.h" |
31 #include "frame.h" | 32 #include "frame.h" |
32 #include "menubar.h" | 33 #include "menubar.h" |
33 #include "redisplay.h" | 34 #include "redisplay.h" |
34 #include "window.h" | 35 #include "window.h" |
176 struct frame *f = decode_frame(Qnil); | 177 struct frame *f = decode_frame(Qnil); |
177 MAYBE_FRAMEMETH (f, popup_menu, (menu_desc,event)); | 178 MAYBE_FRAMEMETH (f, popup_menu, (menu_desc,event)); |
178 return Qnil; | 179 return Qnil; |
179 } | 180 } |
180 | 181 |
182 DEFUN ("normalize-menu-item-name", Fnormalize_menu_item_name, 1, 2, 0, /* | |
183 Convert a menu item name string into normal form. Returns a new string. | |
184 Menu item names should be converted to normal form before being compared. | |
185 */ | |
186 (name, buffer)) | |
187 { | |
188 struct buffer *buf = decode_buffer (buffer, 0); | |
189 struct Lisp_String *n; | |
190 Charcount end; | |
191 int i; | |
192 Bufbyte *name_data; | |
193 Bufbyte *string_result; | |
194 Bufbyte *string_result_ptr; | |
195 Lisp_Object res; | |
196 Emchar elt; | |
197 int expecting_underscore = 0; | |
198 | |
199 CHECK_STRING (name); | |
200 | |
201 n = XSTRING (name); | |
202 end = string_char_length (n); | |
203 name_data = string_data (n); | |
204 | |
205 string_result = (Bufbyte *) alloca (end * MAX_EMCHAR_LEN); | |
206 string_result_ptr = string_result; | |
207 for (i = 0; i < end ; i++) | |
208 { | |
209 elt = charptr_emchar_n (name_data, i); | |
210 elt = DOWNCASE (buf, elt); | |
211 if (elt == '%') | |
212 expecting_underscore = 1; | |
213 else if (expecting_underscore) | |
214 { | |
215 expecting_underscore = 0; | |
216 if (elt != '_') | |
217 { | |
218 string_result_ptr += set_charptr_emchar (string_result_ptr, '%'); | |
219 string_result_ptr += set_charptr_emchar (string_result_ptr, elt); | |
220 } | |
221 } | |
222 else | |
223 string_result_ptr += set_charptr_emchar (string_result_ptr, elt); | |
224 } | |
225 | |
226 return make_string (string_result, string_result_ptr - string_result); | |
227 } | |
228 | |
181 void | 229 void |
182 syms_of_menubar (void) | 230 syms_of_menubar (void) |
183 { | 231 { |
184 defsymbol (&Qcurrent_menubar, "current-menubar"); | 232 defsymbol (&Qcurrent_menubar, "current-menubar"); |
185 DEFSUBR (Fpopup_menu); | 233 DEFSUBR (Fpopup_menu); |
234 DEFSUBR (Fnormalize_menu_item_name); | |
186 } | 235 } |
187 | 236 |
188 void | 237 void |
189 vars_of_menubar (void) | 238 vars_of_menubar (void) |
190 { | 239 { |