if (v && v->handlesCommand(cmd, NULL, &info))
if (v && v->handlesCommand(cmd, NULL, &info) && v->isCommandEnabled(cmd, NULL, &info))
xfeDoCommandAction(Widget w, XEvent *event,		   String *params, Cardinal *num_params){	MWContext *context = fe_WidgetToMWContext(w);	CommandType cmd;	XFE_Frame *f;		if (*num_params < 1) // We must be sent the command to be performed.		{			D(  printf ("There must be at least 1 parameter.  There is %d\n", *num_params);)				return;		}		f = ViewGlue_getFrame(XP_GetNonGridContext(context));		if (!f) // hmm... don't know *how* we could have gotten here otherwise...		return;		cmd = Command::intern(params[0]);#ifdef DEBUG_spence	printf ("cmd: %s\n", cmd);#endif		/* xfeDoCommand(showPopup) and popup() both do the same thing */	if (cmd == xfeCmdShowPopup		&& // dealing with xfeDoPopupAction() is beyond me...djw		XP_STRCMP(XtName(w), "editorDrawingArea") != 0)		{			xfeDoPopupAction(w, event, params, num_params);			return;		}	// Further justification: I really want commands to be delivered to	// the Frame. xfeDoPopupAction() delivers the command to the view.	// This is different from every other command, and breaks the	// way EditorFrame and EditorView talk to each other. So, for now,	// I'm special casing this (I know it's hacky) for the Editor	// and HTML mail compose...djw		String* p_params = NULL;	XFE_CommandEventType cmd_type;	int num_cmd_params = *num_params;	int i;	if (*num_params > 1) // first is name of command.	  p_params = &params[1];	else	  p_params = NULL;	num_cmd_params -= 1;	if (p_params && 		p_params[num_cmd_params - 1] &&		!strcmp(p_params[num_cmd_params - 1], "<remote>"))	  {		cmd_type = XFE_COMMAND_REMOTE_ACTION;		num_cmd_params -= 1;	  }	else	  cmd_type = XFE_COMMAND_EVENT_ACTION;	if (num_cmd_params == 0)		p_params = NULL;		XFE_CommandInfo info(cmd_type, w, event,						 p_params, num_cmd_params);#ifdef ENDER	XFE_View *v = f->widgetToView(w);	if (v && v->handlesCommand(cmd, NULL, &info))	{		if (v->isCommandEnabled(cmd, NULL, &info))		{			XFE_Command *handler = v->getCommand(cmd);			if (handler)			{#ifdef DEBUG_kin				printf("handler->doCommand(0x%.8x): %s\n", handler, cmd);				fflush(stdout);#endif /* DEBUG_kin */				handler->doCommand(v, &info);			}			else			{#ifdef DEBUG_kin				printf("v->doCommand(0x%.8x): %s\n", v, cmd);				fflush(stdout);#endif /* DEBUG_kin */				v->doCommand(cmd, NULL, &info);			}			return;		}	}#endif /* ENDER */	/* if the frame doesn't handle the command, bomb out early */	if (!f->handlesCommand(cmd, NULL, &info))	  {		XBell (XtDisplay(f->getBaseWidget()), 0);		return;	  }	/* if hotkeys are disabled, beep and return */	if (cmd_type != XFE_COMMAND_REMOTE_ACTION &&		f->hotKeysDisabled() &&		/*		** This following set of commands is allowed through regardless of		** whether or not hot keys are enabled		*/		cmd != xfeCmdExit &&		HG20363		cmd != xfeCmdCut &&		cmd != xfeCmdCopy &&		cmd != xfeCmdPaste)	  {		XBell (XtDisplay(f->getBaseWidget()), 0);		return;	  }	if (f->isCommandEnabled(cmd, NULL, &info)) {				xfe_ExecuteCommand(f, cmd, NULL, &info);	}}