+static void populate_preset_menu(frontend *fe,
+ struct preset_menu *menu, HMENU winmenu)
+{
+ int i;
+ for (i = 0; i < menu->n_entries; i++) {
+ struct preset_menu_entry *entry = &menu->entries[i];
+ UINT_PTR id_or_sub;
+ UINT flags = MF_ENABLED;
+
+ if (entry->params) {
+ id_or_sub = (UINT_PTR)(IDM_PRESETS + 0x10 * entry->id);
+
+ fe->preset_menuitems[entry->id].which_menu = winmenu;
+ fe->preset_menuitems[entry->id].item_index =
+ GetMenuItemCount(winmenu);
+ } else {
+ HMENU winsubmenu = CreateMenu();
+ id_or_sub = (UINT_PTR)winsubmenu;
+ flags |= MF_POPUP;
+
+ populate_preset_menu(fe, entry->submenu, winsubmenu);
+ }
+
+ /*
+ * FIXME: we ought to go through and do something with ampersands
+ * here.
+ */
+
+#ifndef _WIN32_WCE
+ AppendMenu(winmenu, flags, id_or_sub, entry->title);
+#else
+ {
+ TCHAR wName[255];
+ MultiByteToWideChar(CP_ACP, 0, entry->title, -1, wName, 255);
+ AppendMenu(winmenu, flags, id_or_sub, wName);
+ }
+#endif
+ }
+}
+