Пример #1
0
int main( int argc, char **argv)
{
    Widget       parent;
    XtAppContext app;
    Arg          args[256];
    Cardinal     ac;
    Boolean      argok=False;
    Widget   topLevelShell;
    Widget   mainWindow_mbgrdviz;
    
    /* Begin user code block <declarations> */
	int	error = MB_ERROR_NO_ERROR;
	int	verbose = 0;
	int	ifileflag = 0;
	int	jfileflag = 0;
	int	testflag = 0;

	/* process argument list */
	while ((c = getopt(argc, argv, "VvHhI:i:J:j:Tt")) != -1)
	  {
	  switch (c) 
		{
		case 'H':
		case 'h':
			help++;
			break;
		case 'V':
		case 'v':
			verbose++;
			break;
		case 'I':
		case 'i':
			sscanf (optarg,"%s", ifile);
			flag++;
			ifileflag++;
			break;
		case 'J':
		case 'j':
			sscanf (optarg,"%s", jfile);
			flag++;
			jfileflag++;
			break;
		case 'T':
		case 't':
			flag++;
			testflag++;
			break;
		case '?':
			errflg++;
		}
	    }

	/* if error flagged then print it and exit */
	if (errflg)
		{
		fprintf(stderr,"usage: %s\n", usage_message);
		fprintf(stderr,"\nProgram <%s> Terminated\n",
			program_name);
		error = MB_ERROR_BAD_USAGE;
		exit(error);
		}

	/* print starting message */
	if (verbose == 1 || help)
		{
		fprintf(stderr,"\nProgram %s\n",program_name);
		fprintf(stderr,"MB-system Version %s\n",MB_VERSION);
		}

	/* print starting message */
	if (help)
		{
		fprintf(stderr,"\n%s\n\nUsage: %s\n", help_message, usage_message);
		error = MB_ERROR_NO_ERROR;
		exit(error);
		}
    
    /* End user code block <declarations> */
    
    /*
     * Initialize Xt. 
     */
    
    XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); 
    
    /*
     * The applicationShell is created as an unrealized
     * parent for multiple topLevelShells.  The topLevelShells
     * are created as popup children of the applicationShell.
     * This is a recommendation of Paul Asente & Ralph Swick in
     * _X_Window_System_Toolkit_ p. 677.
     */
    
    parent = XtVaOpenApplication ( &app, 
                                   BX_APP_CLASS, 
                                   NULL, 
                                   0, 
                                   &argc, 
                                   argv, 
                                   NULL, 
                                   sessionShellWidgetClass, 
                                   NULL );
    
    RegisterBxConverters(app);
    XmRepTypeInstallTearOffModelConverter();
    
    /* Begin user code block <create_shells> */
    /* End user code block <create_shells> */
    
    /*
     * Create classes and widgets used in this program. 
     */
    
    /* Begin user code block <create_topLevelShell> */
    /* End user code block <create_topLevelShell> */
    
    ac = 0;
    XtSetArg(args[ac], XmNtitle, "MBgrdviz"); ac++;
    XtSetArg(args[ac], XmNx, 108); ac++;
    XtSetArg(args[ac], XmNy, 241); ac++;
    XtSetArg(args[ac], XmNwidth, 260); ac++;
    XtSetArg(args[ac], XmNheight, 215); ac++;
    topLevelShell = XtCreatePopupShell((char *)"topLevelShell",
        topLevelShellWidgetClass,
        parent,
        args, 
        ac);
    XtAddCallback(topLevelShell, XmNdestroyCallback, do_mbgrdviz_quit, (XtPointer)0);
    XtAddCallback(topLevelShell, XmNdestroyCallback, BxExitCB, (XtPointer)0);
    mainWindow_mbgrdviz = (Widget)CreatemainWindow_mbgrdviz(topLevelShell);
    XtManageChild(mainWindow_mbgrdviz);
    XtPopup(XtParent(mainWindow_mbgrdviz), XtGrabNone);
    
    /* Begin user code block <app_procedures> */
    
    /* set top level widget */
    mainWindow = mainWindow_mbgrdviz;
    
    /* End user code block <app_procedures> */
    
    /* Begin user code block <main_loop> */
    
    /* initialize the vizualization widgets code */
    mbview_startup(verbose, parent, app, &error);
        
    /* open the file specified on the command line */
    do_mbgrdviz_init(argc,argv, verbose);
    if (ifileflag > 0)
    	{
    	do_mbgrdviz_openprimary(ifile);
	if (jfileflag > 0)
		{
		do_mbgrdviz_openoverlay(0,jfile);
		}
	}
    else if (testflag > 0)
    	{
        do_mbgrdviz_openprimary(NULL);
	}
    /* End user code block <main_loop> */
    
    XtAppMainLoop(app);
    
    /*
     * A return value regardless of whether or not the main loop ends. 
     */
     return(0); 
}
Пример #2
0
int main( int argc, char **argv)
{
    Widget       parent;
    XtAppContext app;
    Arg          args[256];
    Cardinal     ac;
    Widget   topLevelShell;
    Widget   mainWindow_mbeditviz;

    /* Begin user code block <declarations> */

    int		argcsave;
    argcsave = argc;
    argc = 1;

    /* End user code block <declarations> */

    /*
     * Initialize Xt.
     */

    XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL);

    /*
     * The applicationShell is created as an unrealized
     * parent for multiple topLevelShells.  The topLevelShells
     * are created as popup children of the applicationShell.
     * This is a recommendation of Paul Asente & Ralph Swick in
     * _X_Window_System_Toolkit_ p. 677.
     */

    parent = XtVaOpenApplication ( &app,
                                   BX_APP_CLASS,
                                   NULL,
                                   0,
                                   &argc,
                                   argv,
                                   NULL,
                                   sessionShellWidgetClass,
                                   NULL );

    RegisterBxConverters(app);
    XmRepTypeInstallTearOffModelConverter();

    /* Begin user code block <create_shells> */
    /* End user code block <create_shells> */

    /*
     * Create classes and widgets used in this program.
     */

    /* Begin user code block <create_topLevelShell> */
    /* End user code block <create_topLevelShell> */

    ac = 0;
    XtSetArg(args[ac], XmNtitle, "MBeditviz"); ac++;
    XtSetArg(args[ac], XmNx, 180); ac++;
    XtSetArg(args[ac], XmNy, 583); ac++;
    XtSetArg(args[ac], XmNwidth, 453); ac++;
    XtSetArg(args[ac], XmNheight, 557); ac++;
    topLevelShell = XtCreatePopupShell((char *)"topLevelShell",
        topLevelShellWidgetClass,
        parent,
        args,
        ac);
    XtAddCallback(topLevelShell, XmNdestroyCallback, do_mbeditviz_quit, (XtPointer)0);
    XtAddCallback(topLevelShell, XmNdestroyCallback, BxExitCB, (XtPointer)0);
    mainWindow_mbeditviz = (Widget)CreatemainWindow_mbeditviz(topLevelShell);
    XtManageChild(mainWindow_mbeditviz);
    XtPopup(XtParent(mainWindow_mbeditviz), XtGrabNone);

    /* Begin user code block <app_procedures> */

    /* End user code block <app_procedures> */

    /* Begin user code block <main_loop> */

    /* initialize the gui code */
    do_mbeditviz_init(parent, app);

    /* initialize the vizualization widgets code */
    mbview_startup(mbev_verbose, parent, app, &mbev_error);
    mb3dsoundings_startup(mbev_verbose, parent, app, &mbev_error);
    mb3dsoundings_set_dismiss_notify(mbev_verbose, mbeditviz_mb3dsoundings_dismiss, &mbev_error);
    mb3dsoundings_set_edit_notify(mbev_verbose, mbeditviz_mb3dsoundings_edit, &mbev_error);

    /* initialize the program code */
    mbeditviz_init(argcsave,argv);

    /* End user code block <main_loop> */

    XtAppMainLoop(app);

    /*
     * A return value regardless of whether or not the main loop ends.
     */
     return(0);
}