예제 #1
0
/*-------------------------------------------------------------------------*/
void qmonQueuePopup(Widget w, XtPointer cld, XtPointer cad)
{
   lList *alp = NULL;
   
   DENTER(GUI_LAYER, "qmonQueuePopup");

   /* set busy cursor */
   XmtDisplayBusyCursor(w);

   qmonMirrorMultiAnswer(CQUEUE_T | EXECHOST_T | CENTRY_T, &alp);
   if (alp) {
      qmonMessageBox(w, alp, 0);
      lFreeList(&alp);
      /* set busy cursor */
      XmtDisplayDefaultCursor(w);
      DEXIT;
      return;
   }

   if (!qmon_queue) {

      qmonCreateQueueControl(AppShell);

      /*
      ** create queue customize dialog
      */
/*       qmonCreateQCU(qmon_queue, NULL); */

      /* 
      ** set the close button callback 
      ** set the icon and icon name
      */
      XmtCreatePixmapIcon(qmon_queue, qmonGetIcon("toolbar_queue"), None); 
      XtVaSetValues(qmon_queue, XtNiconName, "qmon:Queue Control", NULL);
      XmtAddDeleteCallback(qmon_queue, XmDO_NOTHING, qmonQueuePopdown,  NULL);
      XtAddEventHandler(qmon_queue, StructureNotifyMask, False, 
                        SetMinShellSize, NULL);
      XtAddEventHandler(qmon_queue, StructureNotifyMask, False, 
                        SetMaxShellSize, (XtPointer) SHELL_WIDTH);
      
   }

   xmui_manage(qmon_queue);
/*    ForceUpdate(qmon_queue); */

   updateQueueList();

#if 0
   /*
   ** workaround for display problem of DrawingArea under some WMs
   */
   XtUnmapWidget(queue_da);
   XtMapWidget(queue_da);
#endif   

   /* set busy cursor */
   XmtDisplayDefaultCursor(w);

   DEXIT;
}
예제 #2
0
/*-------------------------------------------------------------------------*/
void qmonBrowserOpen(Widget w, XtPointer cld, XtPointer cad)
{

    DENTER(TOP_LAYER, "qmonBrowserOpen");

    /* set busy cursor */
    XmtDisplayBusyCursor(w);

    if (!BrowserShell) {
        BrowserShell = qmonBrowserCreateDialog(AppShell, "Qmon Object Browser");
        /*
        ** set the close button callback
        ** set the icon and iconName
        */
        XmtCreatePixmapIcon(BrowserShell, qmonGetIcon("toolbar_browser"), None);
        XtVaSetValues(BrowserShell, XtNiconName, "qmon:Browser", NULL);
        XmtAddDeleteCallback(BrowserShell, XmDO_NOTHING, qmonBrowserClose,  NULL);

    }

    xmui_manage(BrowserShell);

    /* set default cursor */
    XmtDisplayDefaultCursor(w);

    DEXIT;

}
예제 #3
0
/*-------------------------------------------------------------------------*/
int main(
int argc,
char **argv 
) {
   Widget StartupWindow = 0;
   Arg  args[10];
   Cardinal ac = 0;
#ifdef L10N
   char *lang;
#endif   
/*    static char app_name[1024]; */

   int i;
   XrmDatabase qmon_database;
   static char progname[256];

   DENTER_MAIN(TOP_LAYER, "qmon_main");

#ifndef L10N
   setlocale(LC_ALL, "C");
   putenv("LANG=C"); 
   putenv("LC_ALL=C"); 
#endif

   /* INSTALL SIGNAL HANDLER */
   qmonInstSignalHandler();

   strcpy(progname, argv[0]);

   /* GENERAL SGE SETUP */
   if (!(argc > 1 && !strcmp(argv[1], "-help"))) {
      qmonInitSge(&ctx, progname, 0);
   } else {  
      /* -help */
      qmonInitSge(&ctx, progname, 1);
   }

   SGE_ROOT = ctx->get_sge_root(ctx);

   /*
   ** Attention !!! Change the XtMalloc() above if you add additional args
   */
   ac = 0;
   XtSetArg(args[ac], XmtNconfigDir, SGE_ROOT); ac++;
   XtSetArg(args[ac], XmtNconfigPath, "%R/locale/%L/%N%S:%R/locale/%l/%N%S:%R/locale/%l_%t.%c/%N%S:%R/qmon/%N%S"); ac++;
/*    XtSetArg(args[ac], XmtNpixmapFilePath, "%R/qmon/PIXMAPS/%N.xpm"); ac++; */
/*    XtSetArg(args[ac], XmtNcontextHelpFile, "qmon_help"); ac++; */
   XtSetArg(args[ac], XtNtitle, "QMON +++ Main Control"); ac++;
   
   /* 
   ** SETUP XMT, here qmon_version is checked, 
   ** so here an exit is possible 
   */
   AppShell = XmtInitialize( &AppContext, APP_NAME,
                             NULL, 0,
                             &argc, argv, 
                             qmon_fallbacks,
                             args, ac);

   sigint_id = XtAppAddSignal(AppContext, sigint_callback, NULL);
   
#if 0
   /*
   ** protocoll the actions performed by qmon
   */
   XtAppAddActionHook(AppContext, TraceActions, NULL);
#endif

#ifdef L10N
   /*
   ** Internationalization:
   ** The qmon_messages.ad file is installed under 
   ** $SGE_ROOT/qmon/locale/<LANG>/qmon_messages.ad
   ** Read in the _Messages_ catalogue
   */
   if (((lang = getenv("LC_MESSAGES")) || (lang = getenv("LC_ALL")) ||
         (lang = getenv("LANG"))) && lang && strcasecmp(lang, "POSIX") &&
         strcasecmp(lang, "C")) {
      DPRINTF(("lang: '%s'\n", lang));
      if (!strcasecmp(lang, "relabel"))   
         lang = "C";
      XmtLoadResourceFile(AppShell, "qmon_messages", False, True);
   }   
#endif

#if 0   
   strcpy(app_name, "QMON +++ Main Control");
   if (strcmp(uti_state_get_default_cell(), "default")) {
      strcat(app_name, " @ ");
      strncat(app_name, uti_state_get_default_cell(), 1000);
   }

   XtVaSetValues(AppShell, 
              XtNtitle, XmtLocalize(AppShell, app_name,
                                    "QMON +++ Main Control"), NULL);
#endif   
   XtVaSetValues(AppShell, 
              XtNtitle, XmtLocalize(AppShell, "QMON +++ Main Control",
                                    "QMON +++ Main Control"), NULL);
   
   /*
   ** we must shift the usage here for internationalization
   */
   if (helpset) {
      qmonUsage(AppShell);
      qmonExitFunc(0);
   }
   
   /* 
   ** get the dialog resource files, they override any settings from the
   ** Qmon app default file concerning dialogue descriptions
   */
   qmon_database = XtDatabase(XtDisplay(AppShell));
   for (i=0; qmon_dialogs[i]; i++) {
      XrmPutLineResource(&qmon_database, qmon_dialogs[i]);
   }
#if 0
   /*
   ** Debugging:
   ** write contents of Resource DB to file DB.TXT in cwd
   */
   XrmPutFileDatabase(qmon_database, "DB.TXT");
#endif   

   /* 
   ** read qmon preferences file ~/.qmon_preferences, it contains
   ** customization info for Queue and Job Control dialogues
   */
   qmonReadPreferences();
   
   /*
   ** display of startup screen ?
   */
   if (!nologo) {
      /* show the user we're starting up */
      StartupWindow = qmonStartupWindow(AppShell);
   }
   
   /* 
   ** INITIALIZE Graphics Contexts 
   */
   qmonCreateGC(AppShell);

   /* 
   ** Allocate Pixel values 
   */
   qmonAllocColor(AppShell);

   /* 
   ** Cache all Icons 
   */
   qmonLoadIcons();

   /* 
   ** set the close button callback 
   ** cause the close button to call the qmonExitCB() 
   ** set the icon and iconName after qmonLoadIcons()
   */
   XmtCreatePixmapIcon(AppShell, qmonGetIcon("mcicon"), None);
   XtVaSetValues(AppShell, XtNiconName, "qmon:Main Control", NULL);
   XmtAddDeleteCallback(AppShell, XmDO_NOTHING, qmonExitCB, NULL);

   /* 
   ** CREATE MainControl 
   */
   MainControl = qmonCreateMainControl(AppShell);

   /* 
   ** install context help 
   */
   XmtHelpInstallContextHelp(AppShell, XmtHelpContextHelpCallback, NULL);
/*    XmtHelpParseFile(AppShell, "qmon_help"); */


   /* 
   ** initialize QmonMirrorList entries 
   */
   qmonMirrorListInit();
   
   /* 
   ** setup timers 
   */
   qmonStartPolling(AppContext);
   
#ifdef HAS_EDITRES
    /* 
    ** Plug in editres protocol handler 
    */
    XtAddEventHandler (AppShell, (EventMask)0, True,
        _XEditResCheckMessages, (XtPointer)NULL);
#endif


   /* 
   ** Popdown startup screen and destroy it
   */
   if (!nologo) {
      sleep(1);
      XtDestroyWidget(StartupWindow);
   }   


   XtRealizeWidget(AppShell);
   XtAppMainLoop(AppContext);

   return 0;
}