⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 macmenus.c

📁 另一个分形程序
💻 C
字号:
/*** mac_menu.c**** Written by Dominic Mazzoni**** This code implements native Macintosh menus for the Xaos Fractal Zoomer.** The root menu becomes the main mac menu bar, with all of its menus appended** after the apple menu.  Any menu titled "help" becomes part of the Mac help** menu.**** This code was adapted from the MS Windows driver source code**** Hierarchical menus inside the Help menu do not work, and I don't know why.** This may be a Mac OS bug.  In the meantime, I moved Tutorials to their own** menu.*/#include "config.h"#include "ui.h"#include "xmenu.h"#include <Menus.h>#define IDMUL 64#define MAIN 0#define POPUP 1#define WSUBMENU 2struct menurecord{  MenuHandle menu;  int type;  int id;  struct uih_context *c;  CONST menuitem *item;  struct menurecord *nextrecord;  struct menurecord *prevrecord;  struct menurecord *submenu;  struct menurecord *nextsubmenu;};struct menurecord *firstrecord;struct menurecord rootmenu;int mac_helpMenuID = -1;MenuHandle mac_helpMenu = 0;int mac_helpMenuItems = 0;static void mac_appendmenu (struct uih_context *c, struct menurecord *menu,			    int is_root);///////////////////////////MenuHandlemac_createrootmenu (){  rootmenu.id = 0;  rootmenu.menu = NULL;  rootmenu.nextrecord = firstrecord;  rootmenu.prevrecord = NULL;  firstrecord = &rootmenu;  rootmenu.nextsubmenu = NULL;  rootmenu.submenu = NULL;  return rootmenu.menu;}static struct menurecord *mac_createmenu (struct uih_context *c,		CONST char *name, CONST char *title, int type, int is_root){  Str255 titlestr;  struct menurecord *m =    (struct menurecord *) calloc (sizeof (struct menurecord), 1);  static int id = 1;  m->id = id++;  m->type = type;  strcpy (titlestr, title);  c2pstr (titlestr);  if (strstr (name, "help"))    {      HMGetHelpMenuHandle (&mac_helpMenu);      mac_helpMenuID = (**(mac_helpMenu)).menuID;      mac_helpMenuItems = CountMenuItems (mac_helpMenu);      m->menu = mac_helpMenu;      m->id = mac_helpMenuID;    }  else    m->menu = NewMenu (m->id, titlestr);  m->c = c;  m->item = menu_findcommand (name);  m->nextrecord = firstrecord;  m->prevrecord = NULL;  firstrecord = m;  m->nextsubmenu = NULL;  m->submenu = NULL;  mac_appendmenu (c, m, false);  if (m->menu != mac_helpMenu)    {      if (is_root)	MacInsertMenu (m->menu, 0);      else if (m->type == MENU_SUBMENU)	MacInsertMenu (m->menu, hierMenu);    }  return m;}static voidmac_appendmenu (struct uih_context *c, struct menurecord *menu, int is_root){  int i, x, y;  CONST menuitem *item;  char out[256];  char used[256];  memset (used, 0, 256);  for (i = 0; (item = menu_item (menu->item->shortname, i)) != NULL; i++)    {      struct menurecord *submenu = NULL;      x = 0;      y = 0;      while (item->name[y])	{	  if ((item->name[y] >= 'A' && item->name[y] <= 'Z') ||	      (item->name[y] >= 'a' && item->name[y] <= 'z') ||	      (item->name[y] >= '0' && item->name[y] <= '9') ||	      item->name[y] == ' ')	    out[x++] = item->name[y];	  if (item->name[y] == '^')	    out[x++] = '`';	  y++;	}      out[x] = 0;      if (item->type == MENU_SUBMENU)	{	  submenu =	    mac_createmenu (c, item->shortname, item->name, MENU_SUBMENU,			    is_root);	  submenu->nextsubmenu = menu->submenu;	  menu->submenu = submenu;	}      // On the Mac it is customary to put ... after menu items      // that bring up a dialog      if (item->type == MENU_CUSTOMDIALOG)	strcat (out, "

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -