Beispiel #1
0
/****************************************************************************
 * Function:	    void DisplayMain(
 *                              Widget parent,
 *                              char *helpVolume,
 *                              char *locationId)
 *
 * Parameters:      
 *
 * Return Value:    Void.
 *
 * Purpose: 	    Displays help for helpdemo in the one helpDialog window 
 *                  created for the applicaiton.
 *
 ****************************************************************************/
void DisplayMain (
    Widget  parent,
    char    *helpVolume,
    char    *locationId)

{
  Arg	 	args[10];	
  int           n;
 
  if (helpMain != NULL)
    {
       n = 0;
       XtSetArg (args[n], XmNtitle, "hemodemo Help");          n++;
       if (helpVolume != NULL)
         {
           XtSetArg (args[n],DtNhelpVolume,helpVolume);     n++; 
         }
       XtSetArg (args[n], DtNlocationId,locationId);        n++;
       XtSetValues(helpMain, args, n);
  
       XtManageChild(helpMain);    
       
     }
   else
     {
       while (!XtIsSubclass(parent, applicationShellWidgetClass))
         parent = XtParent(parent);
     

        /* Build a new one in our cached list */
        n = 0;
        XtSetArg (args[n], XmNtitle, "Helpdemo Help");       n++;
       if (helpVolume != NULL)
         {
           XtSetArg (args[n],DtNhelpVolume,helpVolume);     n++; 
         }
        XtSetArg (args[n], DtNlocationId,locationId);        n++;
        helpMain = DtCreateHelpDialog(parent, "helpWidget", args, n);

        XtAddCallback(helpMain, DtNhyperLinkCallback,
                       ProcessLinkCB, NULL);
             
        XtAddCallback(helpMain, DtNcloseCallback,
                      CloseMainCB, (XtPointer) helpMain);

        /* Add the popup position callback to our main help dialog */
        XtAddCallback (XtParent(helpMain), XmNpopupCallback,
                        (XtCallbackProc)HelpMapCB, 
                        (XtPointer)parent);
 
        XtManageChild(helpMain);    
        
     }
}
Beispiel #2
0
void
HelpAgent::create_ui()
{
  Arg args[2];
  int n;
  Widget app_shell = window_system().toplevel();
  f_appXrmDb = XrmGetDatabase (XtDisplay (app_shell));

  n = 0;
  XtSetArg(args[n], XmNtitle, "Dtinfo Help"); n++;
  f_helper = DtCreateHelpDialog(app_shell,
                                "helpdialog",
                                args, n);
}
Beispiel #3
0
static void
display_help(Calendar *c, ArgList args, int nargs)
{
  if (!c->mainhelpdialog)
  {
    Arg oneArg;
    char *title = XtNewString(catgets(c->DT_catd, 1, 1076, "Calendar : Help"));

    XtSetArg(oneArg, XmNtitle, title);
    c->mainhelpdialog =
      (Widget)DtCreateHelpDialog(c->frame, "mainhelpdialog", &oneArg, 1);
    XtFree(title);
  }

  XtSetValues(c->mainhelpdialog, args, nargs);
  XtManageChild(c->mainhelpdialog);
}
Beispiel #4
0
static Widget
Get_Help_Dialog()
{
    Widget dialog;
    Arg args[5];
    int n;

    n = 0;
    XtSetArg(args[n], XmNtitle, GETMESSAGE(6, 5, "Directory Copy Help"));
    n++;
    dialog = DtCreateHelpDialog(G_toplevel, "helpDlg",  args, n);

    XtAddCallback(dialog, DtNhyperLinkCallback,
                  (XtCallbackProc)help_hyperyperlink_callback, NULL);
    XtAddCallback(dialog, DtNcloseCallback,
                  (XtCallbackProc)help_close_callback, NULL);
    return dialog;
}
Beispiel #5
0
void
Help(
    char *helpVolume,
    char *locationId)
{
    Arg args[10];
    int n;

    if(G_help_dialog == NULL)
    {
        n = 0;
        XtSetArg(args[n], DtNhelpType, DtHELP_TYPE_TOPIC);
        n++;
        XtSetArg(args[n], DtNhelpVolume, helpVolume);
        n++;
        XtSetArg(args[n], DtNlocationId, locationId);
        n++;
        XtSetArg (args[n], XmNtitle,  GETMESSAGE(6, 5, "Directory Copy Help"));
        n++;

        G_help_dialog = DtCreateHelpDialog(G_toplevel, "helpDlg", args, n);

        XtAddCallback(G_help_dialog, DtNhyperLinkCallback,
                      (XtCallbackProc)help_hyperyperlink_callback, NULL);
        XtAddCallback(G_help_dialog, DtNcloseCallback,
                      (XtCallbackProc)help_close_callback, NULL);

        XtManageChild(G_help_dialog);
    }
    else
    {
        n = 0;
        XtSetArg(args[n], DtNhelpType, DtHELP_TYPE_TOPIC);
        n++;
        XtSetArg(args[n], DtNhelpVolume, helpVolume);
        n++;
        XtSetArg(args[n], DtNlocationId, locationId);
        n++;
        XtSetValues(G_help_dialog, args, n);
    }

    XtMapWidget(XtParent(G_help_dialog));
}
Beispiel #6
0
/****************************************************************************
 * Function:	    void DisplayTopic(
 *                              Widget parent,
 *                              char *helpVolume,
 *                              char *locationId)
 *
 * Parameters:      
 *
 * Return Value:    Void.
 *
 * Purpose: 	    Creats and displays a new help dialog w/the requested help
 *                  volume and topic.
 *
 ****************************************************************************/
void DisplayTopic(
    Widget  parent,
    char    *helpVolume,
    char    *locationId)

{
  Arg	 	args[10];	
  int           n;

 CacheListStruct *pCurrentNode = NULL;
  Boolean       cachedNode = FALSE;


  /* Get a inuse node if we have one or a Cached one */
  cachedNode = GetFromCache(parent, &pCurrentNode);


  /* If we got a free one from the Cache, use it */
  /* Set Values on current free one, then map it */
  if (cachedNode)
    {
       n = 0;
       XtSetArg (args[n], XmNtitle, "HelpDemo Help");          n++;
       if (helpVolume != NULL)
         {
           XtSetArg (args[n],DtNhelpVolume,helpVolume);     n++; 
         }
       XtSetArg (args[n], DtNlocationId,locationId);        n++;
       XtSetValues(pCurrentNode->helpDialog, args, n);
  
       XtManageChild(pCurrentNode->helpDialog);    
       XtMapWidget(XtParent(pCurrentNode->helpDialog));
     }
   else
     {
       while (!XtIsSubclass(parent, applicationShellWidgetClass))
         parent = XtParent(parent);
     


        /* Build a new one in our cached list */
        n = 0;
        XtSetArg (args[n], XmNtitle, "Helpdemo Help");          n++;
       if (helpVolume != NULL)
         {
           XtSetArg (args[n],DtNhelpVolume,helpVolume);     n++; 
         }
        XtSetArg (args[n], DtNlocationId,locationId);        n++;
        pCurrentNode->helpDialog =  
                   DtCreateHelpDialog(parent, "helpWidget", args, n);


        XtAddCallback(pCurrentNode->helpDialog, DtNhyperLinkCallback,
                       ProcessLinkCB, NULL);
             
        XtAddCallback(pCurrentNode->helpDialog, DtNcloseCallback,
                      CloseHelpCB, (XtPointer) pCurrentNode->helpDialog);

        XtManageChild(pCurrentNode->helpDialog);    
        XtMapWidget(XtParent(pCurrentNode->helpDialog));
     }
}
Beispiel #7
0
void DisplayHelpDialog(Widget wid, XtPointer client_data, XtPointer cbs)
{
  static Widget  mainHelpDialog = NULL;
  Widget  parent;
  int     i;
  Arg     args[10];
  char    pszTitle[MAXBUFSIZE];
  char    pszTopic[MAXBUFSIZE];

  i = 0;

  /***********************************************************************/
  /* Get help dialog window title.                                       */
  /***********************************************************************/
  /*
  sprintf(pszTitle, "%s  -  %s", GETMESSAGE(3, 10, "Create Action"),
          GETMESSAGE(2, 53, "Help"));
  */
  sprintf(pszTitle, "%s  -  ", GETMESSAGE(3, 10, "Create Action"));
  strcat(pszTitle, GETMESSAGE(2, 53, "Help"));
  XtSetArg(args[i], XmNtitle, pszTitle); i++;

  /***********************************************************************/
  /* Now set the particular helpvolume and topic to view                 */
  /***********************************************************************/
  XtSetArg(args[i], DtNhelpType, DtHELP_TYPE_TOPIC); i++;
  XtSetArg(args[i], DtNhelpVolume, "CreatAct"); i++;
  XtSetArg(args[i], DtNlocationId, pszTopic); i++;

  switch ((int)client_data) {
     case HELP_OVERVIEW:
                         strcpy(pszTopic, "_hometopic");
                         break;
     case HELP_TASKS:
                         strcpy(pszTopic, "Tasks");
                         break;
     case HELP_REFERENCE:
                         strcpy(pszTopic, "Reference");
                         break;
     case HELP_USING:
                         strcpy(pszTopic, "_HOMETOPIC");
                         XtSetArg(args[i], DtNhelpVolume, "Help4Help"); i++;
                         break;
     case HELP_ABOUT:
                         strcpy(pszTopic, "_copyright");
                         break;
     case HELP_ONITEM:
                         strcpy(pszTopic, "CreateActionMainWindow");
                         break;
     case HELP_ADDFILETYPE:
                         strcpy(pszTopic, "AddDatatypeWindow");
                         break;
     case HELP_FILECHAR:
                         strcpy(pszTopic, "DatatypeCriteriaWindow");
                         break;
     case HELP_ICONSELECTOR:
                         strcpy(pszTopic, "FindIconSetDialog");
                         break;
     case HELP_OPENFILE:
                         strcpy(pszTopic, "openDialog");
                         break;
  }

  /***********************************************************************/
  /* Create the Help dialog.                                             */
  /***********************************************************************/
  /*  **** old method of getting parent ****
  XtVaGetValues(wid, XmNuserData, &parent, NULL);
  if (!parent) {
     parent = wid;
  }
  */
  parent = GetTrueToplevel(wid);
  TurnOnHourGlassAllWindows();
  if ( mainHelpDialog == NULL ) {
      mainHelpDialog = DtCreateHelpDialog(parent, "mainHelpDialog", args, i);
      XtAddCallback(mainHelpDialog, DtNcloseCallback,
                (void (*)())closeCB_mainHelpDialog,
                (XtPointer)NULL);
      XtManageChild(mainHelpDialog);
  } else {
     XtSetValues( mainHelpDialog, args, i );
  }
  TurnOffHourGlassAllWindows();
}
Beispiel #8
0
void 
HelpRequestCB(
        Widget w,
        XtPointer clientData,
        XtPointer callData )

{
   XtPointer recordStruct;
   DialogData * dialogData;
   Arg args[8];
   int n;
   String topicTitle = NULL;
   int helpType;
   Boolean freeClientData;
   String fileType;
   String strVal;
   char *vol;
   char *locId;

   /* Refresh the display */
   /* printf ("in HelpRequestCB: clientdata=\"%s\"\n",(char *)clientData); */
   XmUpdateDisplay(w);

   if (recordStruct = LocateRecordStructure(w))
   {
      if (dialogData = _DtGetInstanceData(recordStruct))
      {
         if (IsMainWinDialog(dialogData))
         {
            FileMgrData * fileMgrData = (FileMgrData *)dialogData->data;
            FileMgrRec * fileMgrRec = (FileMgrRec *)recordStruct;

            /* Check for item help */
            if (clientData && strcmp(clientData, HELP_HELP_MODE_STR) == 0)
            {
              if( !ProcessItemHelp( fileMgrRec->shell ) )
              {
                char *tmpStr, *title, *msg;

                tmpStr = GetSharedMessage(ITEM_HELP_ERROR_TITLE);
                title = XtNewString(tmpStr);

                if( fileMgrData->toolbox )
                {
                  tmpStr = GetSharedMessage( AMITEM_HELP_ERROR );
                  msg = XtNewString(tmpStr);
                }
                else
                {
                  tmpStr = GetSharedMessage( ITEM_HELP_ERROR ),
                  msg = XtNewString(tmpStr);
                }

                _DtMessage(fileMgrRec->shell, title, msg, NULL,
                           HelpRequestCB);
                XtFree(title);
                XtFree(msg);
              }
              return;
            }
            /* Item help comes in with a NULL client data */
            if (clientData)
            {
               fileType = NULL;
               topicTitle = NULL;
               helpType = DtHELP_TYPE_TOPIC;
               freeClientData = False;
            }
            else
            {
               if(fileMgrData->selected_file_count > 1)
               {
                 Widget warn;
                 String s;
                 XmString xmstr;

                 n=0;
                 XtSetArg(args[n], XmNokLabelString, okXmString);                        n++;
                 XtSetArg(args[n], XmNcancelLabelString, cancelXmString);                n++;
                 s = GETMESSAGE(29,10, "Help is not available for multiple selected objects.");
                 xmstr = XmStringCreateLocalized(s);

                 XtSetArg(args[n], XmNmessageString, xmstr);                             n++;
                 XtSetArg(args[n], XmNtitle, (GETMESSAGE(29,1, "File Manager Help")));   n++;

                 warn = XmCreateWarningDialog(fileMgrRec->shell, "warn_msg", args, n);

                 XtUnmanageChild(XmMessageBoxGetChild(warn,XmDIALOG_HELP_BUTTON));
                 XtManageChild(warn);
                 XmStringFree(xmstr);

                 return;
               }

               /* Action/Filetype Help */
               topicTitle = GetSharedMessage(ACTION_FT_HELP_TITLE);
               helpType = DtHELP_TYPE_DYNAMIC_STRING;
               fileType = NULL;

               /* Determine string, and set clientData accordingly */
               if ((clientData =
                      MapIconWidgetToFileType(w, fileMgrData)) == NULL)
               {
                  /* Not a file icon; is it an action menu item? */
                  if (!IsMenuWidget(w, fileMgrRec, fileMgrData, &strVal, 
                                    &fileType))
                  {
                     if (! IsFilterIcon(w, fileMgrData, &strVal))
                        return;
                  }
                  clientData = (XtPointer)strVal;
               }
               freeClientData = True;
            }

            /* printf ("topic = %s\n", clientData); */

            /* Special check for 'Using Help'; required different volume */
            locId = (char *)clientData;
            if ((w == *usingHelp) && (strcmp(locId, HELP_HOME_TOPIC) == 0))
               vol = "Help4Help";
            else
               vol = fileMgrData->helpVol;

            if (fileMgrData->primaryHelpDialog)
            {
               ReusePrimaryHelpWindow( fileMgrData->primaryHelpDialog, 
                                       clientData, vol, topicTitle,
                                       fileType, helpType);
            }
            else
            {
               /* Create the main help window for this view */
               ShowHelpDialog(fileMgrRec->shell, (XtPointer)fileMgrRec,
			      MAIN_HELP_DIALOG, 
                              NULL, clientData, vol,
                              topicTitle, fileType, helpType);
            }

            if (freeClientData)
            {
               XtFree(fileType);
               XtFree(clientData);
            }
         }
      }
   }
      else if (clientData)
      {
         Widget mainHelpDialog=NULL;
         Arg args[10];
         int i=0;

         XtSetArg(args[0],XmNuserData,&mainHelpDialog);
         XtGetValues(w,args,1);

         XtSetArg(args[i], DtNhelpType,(unsigned char) DtHELP_TYPE_TOPIC); i++;
         XtSetArg(args[i], DtNhelpVolume, DTFILE_HELP_NAME); i++;
         XtSetArg(args[i], DtNlocationId, clientData); i++;
         XtSetArg(args[i], XmNtitle, (GETMESSAGE(29,1, "File Manager Help")));i++;
         if(!mainHelpDialog || ( mainHelpDialog && !XtIsManaged(mainHelpDialog)) )
	 {

             mainHelpDialog = DtCreateHelpDialog(w, "mainHelpDialog", args, i);
             XtAddCallback(mainHelpDialog, DtNcloseCallback,
                       closeCB_mainHelpDialog,
                       (XtPointer)NULL);
             XtManageChild(mainHelpDialog);
	     XtSetArg(args[0],XmNuserData,mainHelpDialog);
	     XtSetValues(w,args,1);
	 }
	 else
           XtSetValues(mainHelpDialog, args, i);
      }
}