Exemplo n.º 1
0
Arquivo: vidmode.c Projeto: aosm/X11
static int
AddMode(void)
{
    if (addshell == NULL) {
	Widget dialog;

	addshell = XtCreatePopupShell("addMode", transientShellWidgetClass,
				      toplevel, NULL, 0);
	dialog = XtVaCreateManagedWidget("dialog", dialogWidgetClass,
					 addshell, XtNvalue, NULL, NULL, 0);
	XawDialogAddButton(dialog, "yes", PopdownAdd, (XtPointer)True);
	XawDialogAddButton(dialog, "no", PopdownAdd, (XtPointer)False);
	XtRealizeWidget(addshell);
	XSetWMProtocols(DPY, XtWindow(addshell), &wm_delete_window, 1);
    }

    asking_add = 1;

    XtPopup(addshell, XtGrabExclusive);
    while (asking_add)
	XtAppProcessEvent(XtWidgetToApplicationContext(addshell), XtIMAll);

    return (do_add);
}
Exemplo n.º 2
0
void
AutoInvokePerformMonitor()
{
  enum WHICH_TIME get_which_time;
  extern void AutoGetTime();
  Widget PB;
  Arg args[MAX_ARGS];
  int n;


  if (MonitorOn == True)  {
    Command_In_Progress = True;
    /* Use SyncWidget to synchronize the timing of the performance
       monitor wrt the events in the queue.
     */
    if (SyncWidgetCreated != True)  {
      n = 0;
      XtSetArg(args[n], XtNwidth, SYNCWIDTH);                                n++;
      XtSetArg(args[n], XtNheight, SYNCHEIGHT);                              n++;
      XtSetArg(args[n], XtNy, (XHeightOfScreen(screen) - (SYNCHEIGHT+5)));   n++;
      XtSetArg(args[n], XtNx, (XWidthOfScreen(screen) - (SYNCWIDTH+5)));     n++;
      XtSetArg(args[n], XmNpopdownCallback, PopdownCR);                      n++;
      SyncWidget = XtCreatePopupShell ("SyncWidget", topLevelShellWidgetClass,
				       Shell1, args, n);
      XtRealizeWidget(SyncWidget);
      XtPopup(SyncWidget, XtGrabNone);
      SyncWidgetCreated = True;
    }
    else if (SyncWidgetPoppedup == False)  {
      XtPopup(SyncWidget, XtGrabNone);
    }
    SyncWidgetPoppedup = True;
    get_which_time = START_TIME;
    AutoGetTime(get_which_time);
  }
}
Exemplo n.º 3
0
void createConfirmPopup()
{
  Widget form, button_box;

  /* create shell */
  shell = XtCreatePopupShell("confirm", transientShellWidgetClass,
			     toplevel, shell_args, XtNumber(shell_args));

  /* create outer form */
  form = XtCreateManagedWidget("form", formWidgetClass, shell,
				      form_args, XtNumber(form_args) );

  /* create label 1 */
  label_args[4].value = (XtArgVal) resources.label_font;
  label1 = XtCreateManagedWidget("label1",labelWidgetClass, form,
				 label_args, XtNumber(label_args) );

  /* create label 2 */
  label_args[1].value = (XtArgVal) label1;
  label2 = XtCreateManagedWidget("label2",labelWidgetClass, form,
				 label_args, XtNumber(label_args) );

  /* create label 3 */
  label_args[1].value = (XtArgVal) label2;
  label3 = XtCreateManagedWidget("label3",labelWidgetClass, form,
				 label_args, XtNumber(label_args) );

  /* create button box */
  button_box_args[1].value = (XtArgVal) label3;
  button_box = XtCreateManagedWidget("button box", boxWidgetClass, form,
				     button_box_args, 
				     XtNumber(button_box_args) );
  createButtons(confirm_buttons, XtNumber(confirm_buttons), button_box,
		NULL);
  XtRealizeWidget(shell);
}
Exemplo n.º 4
0
/****************************************************************
popup the dialog 10% inside the main-window 
*****************************************************************/
void popup_find_dialog(void)
{
  Position x, y;
  Dimension width, height;

  XtSetSensitive(main_form, FALSE);
  
  find_dialog_shell = XtCreatePopupShell("finddialog", 
					 transientShellWidgetClass,
					 toplevel, NULL, 0);

  find_form = XtVaCreateManagedWidget("findform", 
				      formWidgetClass, 
				      find_dialog_shell, NULL);

  
  find_label = XtVaCreateManagedWidget("findlabel", 
				       labelWidgetClass, 
				       find_form,
				       NULL);

  find_viewport = XtVaCreateManagedWidget("findviewport", 
				      viewportWidgetClass, 
				      find_form, 
				      NULL);
  
  
  find_list = XtVaCreateManagedWidget("findlist", 
				      listWidgetClass, 
				      find_viewport, 
				      XtNlist, 
				      (XtArgVal)dummy_city_list,
				      NULL);
  
  find_center_command = XtVaCreateManagedWidget("findcentercommand", 
						commandWidgetClass,
						find_form,
						NULL);

  find_cancel_command = XtVaCreateManagedWidget("findcancelcommand", 
						commandWidgetClass,
						find_form,
						NULL);

  XtAddCallback(find_center_command, XtNcallback, 
		find_center_command_callback, NULL);
  XtAddCallback(find_cancel_command, XtNcallback, 
		find_cancel_command_callback, NULL);
  

  XtRealizeWidget(find_dialog_shell);

  update_find_dialog(find_list);

  XtVaGetValues(toplevel, XtNwidth, &width, XtNheight, &height, NULL);

  XtTranslateCoords(toplevel, (Position) width/10, (Position) height/10,
		    &x, &y);
  XtVaSetValues(find_dialog_shell, XtNx, x, XtNy, y, NULL);

  XtPopup(find_dialog_shell, XtGrabNone);

  /* force refresh of viewport so the scrollbar is added.
   * Buggy sun athena requires this */
  XtVaSetValues(find_viewport, XtNforceBars, True, NULL);
}
Exemplo n.º 5
0
//
// Create a new foe window
// SG 09.02.91 : Create a new toplevel widget and give it an pixmap icon
// SG : 13.02.91 Fetch a caution box and save the id of the widget in the 
//               foe context for futher use
// SG : 24.02.91 Fetch a widget ( again !) . This time a message box
// SG : 24.03.91 Send the routine the desired position (x_top , y_top) 
// and the desired size ( width_adb , height_adb ) for the window to be created.
// The two first parameters are set to the top level widget
// and the two last paramters are set to the adb widget (see in uil file
// the widget hierarchy )
// SG 14.04.91 A new widget to fetch , the help widget ! 
// SG 2.05.91 New parameter : function ( edit , trace , view , simulate ..)
// to indicate which neted events and which menu entries should be alllowed.
//
pwr_tStatus WFoeMotif::create_window( int x_top,
				 int y_top,
				 int width_adb,
				 int height_adb, 
				 ldh_tSesContext ldhsession,
				 foe_eFuncAccess function_access)
{
  Arg	args[20];
  int	sts;
  Widget *children;
  int i, num_children;
  XmString   	TitleStr;
  Dimension icon_w, icon_h;

  /* DRM database hierarchy related variables */
  MrmHierarchy s_MrmH;
  MrmType dclass;
  char		uid_filename[200] = {"pwr_exe:wb_foe.uid"};
  char		*uid_filename_p = uid_filename;
  static Atom	MwmDeleteWind = 0;
  static char translations[] = "\
<FocusIn>: foe_inputfocus()\n";
  static XtTranslations compiled_translations = NULL;

  static XtActionsRec actions[] =
    {
      {(char*) "foe_inputfocus",      (XtActionProc) action_inputfocus}
    };
       
  sts = dcli_translate_filename( uid_filename, uid_filename);
  if ( EVEN(sts)) {
    printf( "** pwr_exe is not defined\n");
    exit(0);
  }

  /*
   * Now start the module creation
   */

  /* Save the context structure in the widget */
  XtSetArg (args[0], XmNuserData, (XtPointer) this);

  /*
   * Create a new main widget
   */
  /*
   * Open the UID files (the output of the UIL compiler) in the hierarchy
   * Register the items DRM needs to bind for us.
   * Create a new neted-widget
   * Close the hierarchy
   * Compile the additional button translations and augment and add actions
   */ 
  sts = MrmOpenHierarchy( 1, &uid_filename_p, NULL, &s_MrmH);
  if (sts != MrmSUCCESS) {
    printf("can't open hierarchy\n");
    return 0;
  }

  register_callbacks();

  /* SG 09.02.91 : create the new hierarchy. By the way use a pixmap define
  with help of wb_foe_ptrn.h */

  /* create a pixmap for the icon */
  if ( icon_pixmap == 0 )
    sts = MrmFetchBitmapLiteral(s_MrmH,(char*) "icon",
				XtScreen(parent_wid), XtDisplay(parent_wid),
				&icon_pixmap, &icon_w, &icon_h);  
 
  i=0;
  XtSetArg(args[i],XmNiconName,name);  i++;
  XtSetArg(args[i],XtNiconPixmap,icon_pixmap);  i++;
  
  /* SG 11.02.91 Save the id of the top in the context */ 
  parent_wid = XtCreatePopupShell("plcEditor", 
		     topLevelShellWidgetClass, parent_wid, args, i);

  if (compiled_translations == NULL) 
    XtAppAddActions( XtWidgetToApplicationContext( parent_wid), 
						actions, XtNumber(actions));

  /* the positioning of a top level can only be define after the creation
      of the widget . So i do it know: 
     SG 24.02.91 use the parameters received x and y 
  */

  i=0;
  XtSetArg(args[i],XmNx,x_top);i++;
  XtSetArg(args[i],XmNy,y_top);i++;
  XtSetArg(args[i],XtNallowShellResize,TRUE), i++;

  if ( ! map_window) {
    XtSetArg(args[i],XmNmappedWhenManaged,FALSE); i++;
  }

  XtSetValues( parent_wid, args, i);

  XtSetArg (args[0], XmNuserData, (XtPointer) this);

  /* now that we have a top level we can get the main window */
  sts = MrmFetchWidgetOverride(s_MrmH, (char*) "foe_window", parent_wid ,
		name, args, 1,
		&widgets.foe_window, &dclass);
  if (sts != MrmSUCCESS) printf("can't fetch foedit widget\n");

  /* SG 24.02.91 Set the width and hight desired for the main window to his
	child the adb widget */
  i=0;
  XtSetArg(args[i],XmNwidth,width_adb);i++;
  XtSetArg(args[i],XmNheight,height_adb);i++;
  XtSetValues( widgets.adb  ,args,i);

  /* SG 24.02.91
     Get a litle message box widget that you will make appears when you want by
     calling foe_msgbox
  */

  if (MrmFetchWidget (s_MrmH, 
			(char*) "foe_msgbox", 
			widgets.foe_window,
			&widgets.msgbox,
			&dclass) != MrmSUCCESS)
	printf("can't fetch msgbox \n");

  TitleStr = XmStringCreateLtoR((char*) "PlcEdit Message" , (char*) "ISO8859-1");    
  XtSetArg(args[0],XmNdialogTitle,TitleStr);
  XtSetValues( widgets.msgbox, args, 1);
  XmStringFree(TitleStr);


  /* SG 13.02.91 
     Get a litle caution widget that you will make appears when you want by
     calling foe_popupmsg 
  */

  if (MrmFetchWidget (s_MrmH, 
			(char*) "foe_popupmsg", 
			widgets.foe_window,
			&widgets.caution,
			&dclass) != MrmSUCCESS)
    printf("can't fetch popupmsg\n");

  TitleStr = XmStringCreateLtoR((char*) "PlcEdit Confirm" , (char*) "ISO8859-1");    
  XtSetArg(args[0],XmNdialogTitle,TitleStr);
  XtSetValues( widgets.caution, args, 1);
  XmStringFree(TitleStr);


  /* create the pane widgets */
  /* create the palette module */
  /* SG 07.03.91 put two palletes in the sub pane widget */

  node_palctx = new PalMotif( this, widgets.subpane, "Objects",
		ldhsession, "PlcEditorPalette", 
		&widgets.node_palette, &sts);
  node_palette_managed = 1;

  navctx = new NavMotif( this, widgets.subpane, "Plant",
		ldhsession, "NavigatorW1",
		&widgets.nav_palette, &sts);
  XtUnmanageChild( widgets.nav_palette);

  con_palctx = new PalMotif( this, widgets.subpane, "Connections",
		ldhsession, "PlcEditorConPalette", 
		&widgets.con_palette, &sts);
  XtUnmanageChild( widgets.con_palette);


  /* Turn off traversal for sash widgets */
  XtVaGetValues(widgets.subpane, 
		XmNchildren, &children,
		XmNnumChildren, &num_children,
		NULL);
  for (i = 0; i < num_children; i++) {
    if (XmIsSash(children[i]))
      XtVaSetValues(children[i], XmNtraversalOn, False, NULL);
  }

  /* create the gredit module */
  XtManageChild(widgets.foe_window);


  gre = new WGreMotif( this, widgets.pane, "Name");

  ((WGreMotif *)gre)->new_navigator( widgets.subpane);

  if ( map_window)
    XtPopup(parent_wid, XtGrabNone);
  else
    XtRealizeWidget( parent_wid);

  gre->init();

  /* create the setup ie:
     enable netedevents,
     enable menu entries
     setup backcalls from the gredit module */

  function_setup();

  MrmCloseHierarchy(s_MrmH);

  if (compiled_translations == NULL) 
    compiled_translations = XtParseTranslationTable(translations);
  XtOverrideTranslations( widgets.foe_window, compiled_translations);

  XtUnmanageChild(widgets.textinput);

  if ( !(CoLogin::privilege() & pwr_mPrv_DevPlc ) || 
       (function_access == foe_eFuncAccess_View)) {
    /* Mode Edit and Simulate is not allowed */
    i=0;
    XtSetArg(args[i],XmNsensitive,0); i++;

    XtSetValues( widgets.edit_togg,args,i);
    XtSetValues( widgets.simulate_togg,args,i);
  }

  if (MwmDeleteWind == 0)
    MwmDeleteWind = XInternAtom(XtDisplay(parent_wid), "WM_DELETE_WINDOW", FALSE);

  if (MwmDeleteWind != 0) {
    XtVaSetValues(parent_wid, XmNdeleteResponse, XmDO_NOTHING, NULL);
    XmAddWMProtocolCallback(parent_wid, MwmDeleteWind, 
			    (XtCallbackProc)activate_quit, this);
  }

  CoWowMotif::GetAtoms( parent_wid, 0, &objid_atom, 0);

  /* SG 09.02.91 a top level should always be realized !
   * ML 16.03.94 changed Realize to Popup
   */

  return FOE__SUCCESS;
}
Exemplo n.º 6
0
static void ui_confirm (char *message, int ok_only)

{
    Widget      form, picture, label;
    Arg		args[5];
    Widget	button;
    Cardinal	n;
    XEvent      event;

    /* Now create Popup */

    ui_cf_popup = 
	XtCreatePopupShell("confirmer", transientShellWidgetClass, ui_toplevel,
			   NULL, 0);
    form = 
	XtCreateManagedWidget("form", formWidgetClass, ui_cf_popup, NULL, 0);

    if (ok_only) {
	n = 0;
	XtSetArg(args[n], XtNborderWidth, 0); n++;
	XtSetArg(args[n], XtNbitmap, 
		 (Pixmap) XCreateBitmapFromData(ui_display, 
						XDefaultRootWindow(ui_display),
						exclamation_bits, 
						exclamation_width,
						exclamation_height)); n++;
    	picture = 
	    XtCreateManagedWidget("exclamation", labelWidgetClass, form, 
				  args, n);     

	n = 0;
	XtSetArg(args[n], XtNfromHoriz, picture); n++;
	XtSetArg(args[n], XtNborderWidth, 0); n++;
	XtSetArg(args[n], XtNlabel,     message); n++;
	label = XtCreateManagedWidget("confirmerMsg", labelWidgetClass, form, 
				      args, n);
    
	button = ui_xCreateButtonItem("ok", form, picture, label);
	XtAddCallback(button, XtNcallback, (XtCallbackProc) ui_cf_yesNoOk, 
		      (XtPointer) ((long)1));	

    } else {
	n = 0;
	XtSetArg(args[n], XtNborderWidth, 0); n++;
	XtSetArg(args[n], XtNbitmap, 
		 (Pixmap) XCreateBitmapFromData(ui_display, 
						XDefaultRootWindow(ui_display),
						stopIcon_bits, stopIcon_width,
						stopIcon_height)); n++;
	picture =
	    XtCreateManagedWidget("stop", labelWidgetClass, form, 
				  args, n);

	n = 0;
	XtSetArg(args[n], XtNfromHoriz, picture); n++;
	XtSetArg(args[n], XtNborderWidth, 0); n++;
	XtSetArg(args[n], XtNlabel,     message); n++;
	label = 
	    XtCreateManagedWidget("confirmerNsg", labelWidgetClass, form, 
				  args, n);

	button = ui_xCreateButtonItem("yes", form, picture, label);
	XtAddCallback(button, XtNcallback, (XtCallbackProc) ui_cf_yesNoOk, 
		      (XtPointer) ((long)1));	

	button = ui_xCreateButtonItem("no", form, button, label);
	XtAddCallback(button, XtNcallback, (XtCallbackProc) ui_cf_yesNoOk, 
		      (XtPointer) ((long)0));	
    }
    XawFormDoLayout(form, True);
    XtRealizeWidget(ui_cf_popup);
    
    /* now move the popup to the middle of the screen */
    {
	Window root;
	int    x, y;
	unsigned int borderWidth, depth, width, height;
	XWindowChanges xChange;
	
	(void) XGetGeometry(ui_display, XtWindow(ui_cf_popup),
			    &root, &x, &y, &width, &height, &borderWidth, &depth);
	
	xChange.x = 
	    (int) ((XDisplayWidth(ui_display, ui_screen) - width) / 2);
	xChange.y =
	    (int) ((XDisplayHeight(ui_display, ui_screen) - height) / 2);
	xChange.stack_mode = (int) Above;
	XConfigureWindow(ui_display, XtWindow(ui_cf_popup), 
			 CWX BIT_OR CWY BIT_OR CWStackMode, &xChange);
    }

    XtPopup(ui_cf_popup, XtGrabExclusive);
    ui_xDontResizeWidget(ui_cf_popup); 

    /* now enter the confirmer loop.
       Everthing behaves the same, because its an copy of XtAppMainLoop(), 
       but it stops UI from processing code from here back to the main loop.
       This is needed, because the confirmer should return values! */

    ui_cf_exit = FALSE;
    while (NOT ui_cf_exit) {
	XtAppNextEvent(ui_appContext, &event);
	(void) XtDispatchEvent(&event);
    }
}
Exemplo n.º 7
0
/**************************************************************************
...
**************************************************************************/
static void popit(int xin, int yin, struct tile *ptile)
{
  Position x, y;
  int dw, dh;
  Dimension w, h, b;
  static struct tile *cross_list[2+1];
  struct tile **cross_head = cross_list;
  int i;
  struct unit *punit;
  char *content;
  static bool is_orders;
  
  if (TILE_UNKNOWN != client_tile_get_known(ptile)) {
    Widget p=XtCreatePopupShell("popupinfo", simpleMenuWidgetClass,
				map_canvas, NULL, 0);
    content = (char *) popup_info_text(ptile);
    /* content is provided to us as a single string with multiple lines,
       but xaw doens't support multi-line labels.  So we break it up.
       We mangle it in the process, but who cares?  It's never going to be
       used again anyway. */
    while (1) {
      char *end = strchr(content, '\n'); 
      if (end) {
	*end='\0';
      }
      XtCreateManagedWidget(content, smeBSBObjectClass, p, NULL, 0);
      if (end) {
	content = end+1;
      } else {
	break;
      }
    }

    punit = find_visible_unit(ptile);
    is_orders = show_unit_orders(punit);
    if (punit && punit->goto_tile) {
      *cross_head = punit->goto_tile;
      cross_head++;
    }
    *cross_head = ptile;
    cross_head++;

    xin /= tileset_tile_width(tileset);
    xin *= tileset_tile_width(tileset);
    yin /= tileset_tile_height(tileset);
    yin *= tileset_tile_height(tileset);
    xin += (tileset_tile_width(tileset) / 2);
    XtTranslateCoords(map_canvas, xin, yin, &x, &y);
    dw = XDisplayWidth (display, screen_number);
    dh = XDisplayHeight (display, screen_number);
    XtRealizeWidget(p);
    XtVaGetValues(p, XtNwidth, &w, XtNheight, &h, XtNborderWidth, &b, NULL);
    w += (2 * b);
    h += (2 * b);
    x -= (w / 2);
    y -= h;
    if ((x + w) > dw) x = dw - w;
    if (x < 0) x = 0;
    if ((y + h) > dh) y = dh - h;
    if (y < 0) y = 0;
    XtVaSetValues(p, XtNx, x, XtNy, y, NULL);

    *cross_head = NULL;
    for (i = 0; cross_list[i]; i++) {
      put_cross_overlay_tile(cross_list[i]);
    }
    XtAddCallback(p,XtNpopdownCallback,popupinfo_popdown_callback,
		  (XtPointer)&is_orders);

    XtPopupSpringLoaded(p);
  }
  
}
Exemplo n.º 8
0
WdaMotif::WdaMotif( 
	Widget 		wa_parent_wid,
	void 		*wa_parent_ctx, 
	ldh_tSesContext wa_ldhses, 
	pwr_tObjid 	wa_objid,
	pwr_tClassId 	wa_classid,
	const char      *wa_attribute,
	int 		wa_editmode,
	int 		wa_advanced_user,
	int		wa_display_objectname) :
  Wda(wa_parent_ctx,wa_ldhses,wa_objid,wa_classid,wa_attribute,wa_editmode,
      wa_advanced_user,wa_display_objectname), 
  parent_wid(wa_parent_wid), set_focus_disabled(0), value_current_recall(0)
{
  char		uid_filename[120] = {"pwr_exe:wb_wda.uid"};
  char		*uid_filename_p = uid_filename;
  Arg 		args[20];
  pwr_tStatus	sts;
  char 		title[80];
  int		i;
  MrmHierarchy s_DRMh;
  MrmType dclass;
  char		name[] = "Proview/R Navigator";

  static char translations[] =
    "<FocusIn>: wda_inputfocus()\n";
  static XtTranslations compiled_translations = NULL;

  static XtActionsRec actions[] =
  {
    {(char*) "wda_inputfocus",      (XtActionProc) action_inputfocus}
  };

  static MrmRegisterArg	reglist[] = {
        {(char*) "wda_ctx", 0 },
	{(char*) "wda_activate_setclass",(caddr_t)activate_setclass },
	{(char*) "wda_activate_setattr",(caddr_t)activate_setattr },
	{(char*) "wda_activate_nextattr",(caddr_t)activate_nextattr },
	{(char*) "wda_activate_prevattr",(caddr_t)activate_prevattr },
	{(char*) "wda_activate_exit",(caddr_t)activate_exit },
	{(char*) "wda_activate_print",(caddr_t)activate_print },
	{(char*) "wda_activate_change_value",(caddr_t)activate_change_value },
	{(char*) "wda_activate_close_changeval",(caddr_t)activate_close_changeval },
	{(char*) "wda_activate_help",(caddr_t)activate_help },
	{(char*) "wda_create_msg_label",(caddr_t)create_msg_label },
	{(char*) "wda_create_cmd_prompt",(caddr_t)create_cmd_prompt },
	{(char*) "wda_create_cmd_input",(caddr_t)create_cmd_input },
	{(char*) "wda_create_cmd_scrolledinput",(caddr_t)create_cmd_scrolledinput },
	{(char*) "wda_create_cmd_scrolled_ok",(caddr_t)create_cmd_scrolled_ok },
	{(char*) "wda_create_cmd_scrolled_ca",(caddr_t)create_cmd_scrolled_ca },
	{(char*) "wda_create_wdanav_form",(caddr_t)create_wdanav_form },
	{(char*) "wda_activate_cmd_scrolledinput",(caddr_t)activate_cmd_input },
	{(char*) "wda_activate_cmd_scrolled_ok",(caddr_t)activate_cmd_scrolled_ok },
	{(char*) "wda_activate_cmd_scrolled_ca",(caddr_t)activate_cmd_scrolled_ca },
	{(char*) "wdaclass_activate_ok",(caddr_t)class_activate_ok },
	{(char*) "wdaclass_activate_cancel",(caddr_t)class_activate_cancel },
	{(char*) "wdaclass_create_hiervalue",(caddr_t)class_create_hiervalue },
	{(char*) "wdaclass_create_classvalue",(caddr_t)class_create_classvalue },
	{(char*) "wdaclass_create_attrobjects",(caddr_t)class_create_attrobjects }
	};

  static int	reglist_num = (sizeof reglist / sizeof reglist[0]);

  // for ( i = 0; i < int(sizeof(value_recall)/sizeof(value_recall[0])); i++)
  //  value_recall[i][0] = 0;

  dcli_translate_filename( uid_filename, uid_filename);

  // Create object context
//  attrctx->close_cb = close_cb;
//  attrctx->redraw_cb = redraw_cb;

  // Motif
  MrmInitialize();

  strcpy( title, "PwR Object attributes");

  reglist[0].value = (caddr_t) this;

  // Save the context structure in the widget
  XtSetArg (args[0], XmNuserData, (XtPointer) this);

  sts = MrmOpenHierarchy( 1, &uid_filename_p, NULL, &s_DRMh);
  if (sts != MrmSUCCESS) printf("can't open %s\n", uid_filename);

  MrmRegisterNames(reglist, reglist_num);

  parent_wid = XtCreatePopupShell("spreadSheetEditor", 
		topLevelShellWidgetClass, parent_wid, args, 0);

  sts = MrmFetchWidgetOverride( s_DRMh, (char*) "wda_window", parent_wid,
			name, args, 1, &toplevel, &dclass);
  if (sts != MrmSUCCESS)  printf("can't fetch %s\n", name);

  sts = MrmFetchWidget(s_DRMh, (char*) "wdaclass_dia", parent_wid,
		&wdaclass_dia, &dclass);
  if (sts != MrmSUCCESS)  printf("can't fetch class input dialog\n");

  MrmCloseHierarchy(s_DRMh);


  if (compiled_translations == NULL) 
    XtAppAddActions( XtWidgetToApplicationContext(toplevel), 
						actions, XtNumber(actions));
 
  if (compiled_translations == NULL) 
    compiled_translations = XtParseTranslationTable(translations);
  XtOverrideTranslations( toplevel, compiled_translations);

  i = 0;
  XtSetArg(args[i],XmNwidth,800);i++;
  XtSetArg(args[i],XmNheight,600);i++;
  XtSetValues( toplevel ,args,i);
    
  XtManageChild( toplevel);
  XtUnmanageChild( cmd_input);
  XtUnmanageChild( cmd_scrolledinput);
  XtUnmanageChild( cmd_scrolled_ok);
  XtUnmanageChild( cmd_scrolled_ca);

  utility = ((WUtility *)parent_ctx)->utype;
  wdanav = new WdaNavMotif( (void *)this, wdanav_form, "Plant",
		ldhses, objid, classid, attribute, wa_editmode,
		wa_advanced_user,
		wa_display_objectname, utility, &brow_widget, &sts);
  ((WdaNav *)wdanav)->message_cb = &Wda::message_cb;
  ((WdaNav *)wdanav)->change_value_cb = &Wda::change_value_cb;

  XtPopup( parent_wid, XtGrabNone);

  wow = new CoWowMotif( parent_wid);

  // Connect the window manager close-button to exit
  flow_AddCloseVMProtocolCb( parent_wid, 
	(XtCallbackProc)activate_exit, this);

  if ( utility == wb_eUtility_Wtt)
  {
    ((Wtt *)parent_ctx)->register_utility( (void *) this,
	wb_eUtility_SpreadsheetEditor);
  }
}
Exemplo n.º 9
0
/*******************************************************************************
          Name:        FileSelect
          Description: Pops up window in center of the Dialog Window for file
                       selection by user
          Arguments:  None
          Returns:     None
          Contrubuting Programmers:  Albert Leigh - MacDonnell Douglas
                                     Stan Smith - Barrios
                                     some guy upstairs
******************************************************************************/
void FileSelect()
  {
  Widget file_form, file_dialog, view;
    

  /*XDefineCursor(XtDisplay(toplevel),toplevel,XC_watch);*/
  file = XtCreatePopupShell("File",
                            topLevelShellWidgetClass,
                            toplevel,
                            NULL, 0);

  file_form = XtCreateManagedWidget("file_form",
                                    formWidgetClass,
                                    file,
                                    NULL, 0);

  XtSetArg(args[0], XtNforceBars, True);
  XtSetArg(args[1], XtNbottom, XtChainBottom);
  XtSetArg(args[2], XtNheight,150);
  XtSetArg(args[3], XtNallowHoriz,True);
  XtSetArg(args[4],XtNallowVert,True);
  view = XtCreateManagedWidget("view",
                               viewportWidgetClass,
                               file_form,
                               args, 5);

  /* =============================================================== *
   *  Create the Select/Cancel dialog box in the file selection      *
   *  dialog box.                                                    *
   * =============================================================== */

  XtSetArg(args[0], XtNresizable, True);
  XtSetArg(args[1], XtNlabel, "Enter File Name");
  XtSetArg(args[2], XtNvalue, "");
  XtSetArg(args[3], XtNfromVert, view);
  XtSetArg(args[4], XtNicon, clips_logo);
  XtSetArg(args[5], XtNleft, XtChainLeft);
  XtSetArg(args[6], XtNright, XtChainRight);
  XtSetArg(args[7], XtNtop, XtChainBottom);
  XtSetArg(args[8], XtNbottom, XtChainBottom);
  file_dialog = XtCreateManagedWidget("file_dialog",
                                      dialogWidgetClass,
                                      file_form,
                                      args, 9);
  XawDialogAddButton(file_dialog, "SELECT", MenuFunc, (XtPointer) file_dialog);
  XawDialogAddButton(file_dialog, "CANCEL", CancelPopupSelect,
                     (XtPointer) file_form);

  XtSetArg(args[0], XtNfromHoriz, file_dialog);
  XtSetArg(args[1], XtNfromVert, view);

  /* =============================================================== *
   *  Get the path of the current dirrectory                         *
   * =============================================================== */

  if(getwd(path) == NULL)
    printf("Error getting current working directory '%s'\n", path);

  if(path[strlen(path) - 1] != '/')
    strcat(path, "/");

  /* =============================================================== *
   *  Create the file dialog list box                                *
   * =============================================================== */

  XtSetArg(args[0], XtNdefaultColumns, 4);
  XtSetArg(args[1], XtNlist, GetDirectory());
  XtSetArg(args[2], XtNforceColumns, False);
  XtSetArg(args[3], XtNverticalList, True);
  XtSetArg(args[4], XtNinternalWidth, 10);
  file_list = XtCreateManagedWidget("file_dialog",
                                    listWidgetClass,
                                    view,
                                    args, 5);
  XtAddCallback(file_list, XtNcallback, FileToDialog, (XtPointer) file_dialog);

  XtPopup(file, XtGrabNonexclusive);
  /*XDefineCursor(XtDisplay(toplevel),toplevel,None);*/
  }
Exemplo n.º 10
0
static int motDialogMapMethod(Ihandle* ih)
{
  Widget dialog_manager;
  InativeHandle* parent;
  int mwm_decor = 0;
  int num_args = 0;
  Arg args[20];

  if (iupAttribGetInt(ih, "DIALOGFRAME")) 
  {
    iupAttribSetStr(ih, "RESIZE", "NO");
    iupAttribSetStr(ih, "MAXBOX", "NO");
    iupAttribSetStr(ih, "MINBOX", "NO");
  }

  /****************************/
  /* Create the dialog shell  */
  /****************************/

  if (iupAttribGet(ih, "TITLE"))
      mwm_decor |= MWM_DECOR_TITLE;
  if (iupAttribGetInt(ih, "MENUBOX"))
      mwm_decor |= MWM_DECOR_MENU;
  if (iupAttribGetInt(ih, "MINBOX"))
      mwm_decor |= MWM_DECOR_MINIMIZE;
  if (iupAttribGetInt(ih, "MAXBOX"))
      mwm_decor |= MWM_DECOR_MAXIMIZE;
  if (iupAttribGetInt(ih, "RESIZE"))
      mwm_decor |= MWM_DECOR_RESIZEH;
  if (iupAttribGetInt(ih, "BORDER"))
      mwm_decor |= MWM_DECOR_BORDER;

  iupmotSetArg(args, num_args, XmNmappedWhenManaged, False);  /* so XtRealizeWidget will not show the dialog */
  iupmotSetArg(args, num_args, XmNdeleteResponse, XmDO_NOTHING);
  iupmotSetArg(args, num_args, XmNallowShellResize, True); /* Used so the BulletinBoard can control the shell size */
  iupmotSetArg(args, num_args, XmNtitle, "");
  iupmotSetArg(args, num_args, XmNvisual, iupmot_visual);
  
  if (iupmotColorMap()) 
    iupmotSetArg(args, num_args, XmNcolormap, iupmotColorMap());

  if (mwm_decor != 0x7E) 
    iupmotSetArg(args, num_args, XmNmwmDecorations, mwm_decor);

  if (iupAttribGetInt(ih, "SAVEUNDER"))
    iupmotSetArg(args, num_args, XmNsaveUnder, True);

  parent = iupDialogGetNativeParent(ih);
  if (parent)
    ih->handle = XtCreatePopupShell(NULL, topLevelShellWidgetClass, (Widget)parent, args, num_args);
  else
    ih->handle = XtAppCreateShell(NULL, "dialog", topLevelShellWidgetClass, iupmot_display, args, num_args);

  if (!ih->handle)
    return IUP_ERROR;

  XmAddWMProtocolCallback(ih->handle, iupmot_wm_deletewindow, motDialogCBclose, (XtPointer)ih);

  XtAddEventHandler(ih->handle, FocusChangeMask, False, (XtEventHandler)iupmotFocusChangeEvent,      (XtPointer)ih);
  XtAddEventHandler(ih->handle, EnterWindowMask, False, (XtEventHandler)iupmotEnterLeaveWindowEvent, (XtPointer)ih);
  XtAddEventHandler(ih->handle, LeaveWindowMask, False, (XtEventHandler)iupmotEnterLeaveWindowEvent, (XtPointer)ih);
  XtAddEventHandler(ih->handle, StructureNotifyMask, False, (XtEventHandler)motDialogCBStructureNotifyEvent, (XtPointer)ih);

  XtAddCallback(ih->handle, XmNdestroyCallback, (XtCallbackProc)motDialogDestroyCallback, (XtPointer)ih);

  /*****************************/
  /* Create the dialog manager */
  /*****************************/

  dialog_manager = XtVaCreateManagedWidget(
              "dialog_manager",
              xmBulletinBoardWidgetClass,
              ih->handle,
              XmNmarginWidth, 0,
              XmNmarginHeight, 0,
              XmNwidth, 100,     /* set this to avoid size calculation problems */
              XmNheight, 100,
              XmNborderWidth, 0,
              XmNshadowThickness, 0,
              XmNnoResize, iupAttribGetInt(ih, "RESIZE")? False: True,
              XmNresizePolicy, XmRESIZE_NONE, /* no automatic resize of children */
              XmNuserData, ih, /* used only in motDialogConfigureNotify                   */
              XmNnavigationType, XmTAB_GROUP,
              NULL);

  XtOverrideTranslations(dialog_manager, XtParseTranslationTable("<Configure>: iupDialogConfigure()"));
  XtAddCallback(dialog_manager, XmNhelpCallback, (XtCallbackProc)iupmotHelpCallback, (XtPointer)ih);
  XtAddEventHandler(dialog_manager, KeyPressMask, False,(XtEventHandler)iupmotKeyPressEvent, (XtPointer)ih);

  /* force the BGCOLOR to match the DLGBGCOLOR */
  motDialogSetBgColorAttrib(ih, IupGetGlobal("DLGBGCOLOR"));

  /* initialize the widget */
  XtRealizeWidget(ih->handle);

  /* child dialogs must be always on top of the parent */
  if (parent)
    XSetTransientForHint(iupmot_display, XtWindow(ih->handle), XtWindow(parent));

  if (mwm_decor != 0x7E)  /* some decoration was changed */
    motDialogSetWindowManagerStyle(ih);

  /* Ignore VISIBLE before mapping */
  iupAttribSetStr(ih, "VISIBLE", NULL);

  if (IupGetGlobal("_IUP_SET_DLGFGCOLOR"))
  {
    iupmotSetGlobalColorAttrib(dialog_manager, XmNforeground, "DLGFGCOLOR");
    IupSetGlobal("_IUP_SET_DLGFGCOLOR", NULL);
  }

  return IUP_NOERROR;
}
Exemplo n.º 11
0
Arquivo: light.c Projeto: Thump/sceda
static void
Create_Arealight_Dialog()
{
	Widget	form;
	Widget	labels[3];
	Widget	done, cancel;
	Arg		args[15];
	int		m, n;

	n = 0;
	XtSetArg(args[n], XtNtitle, "Arealight");		n++;
	XtSetArg(args[n], XtNallowShellResize, TRUE);	n++;
	arealight_shell = XtCreatePopupShell("arealightShell",
						transientShellWidgetClass, main_window.shell, args, n);

	n = 0;
	form = XtCreateManagedWidget("arealightForm", formWidgetClass,
								 arealight_shell, args, n);

	/* Common args. */
	m = 0;
	XtSetArg(args[m], XtNleft, XtChainLeft);		m++;
	XtSetArg(args[m], XtNright, XtChainRight);		m++;
	XtSetArg(args[m], XtNtop, XtChainTop);			m++;
	XtSetArg(args[m], XtNbottom, XtChainBottom);	m++;

	/* Intensity label. */
	n = m;
	XtSetArg(args[n], XtNlabel, "Intensity");		n++;
	XtSetArg(args[n], XtNborderWidth, 0);			n++;
	labels[0] = XtCreateManagedWidget("arealightIntensityLabel",
									  labelWidgetClass, form, args, n);

	/* Intensity text. */
	n = m;
	XtSetArg(args[n], XtNeditType, XawtextEdit);		n++;
	XtSetArg(args[n], XtNlength, MAX_STRING_LENGTH);	n++;
	XtSetArg(args[n], XtNuseStringInPlace, TRUE);		n++;
	XtSetArg(args[n], XtNstring, intensity_string);		n++;
	XtSetArg(args[n], XtNfromHoriz, labels[0]);			n++;
	arealight_intensity_text = XtCreateManagedWidget("arealightIntensityText",
					asciiTextWidgetClass, form, args, n);
	XtOverrideTranslations(arealight_intensity_text,
		XtParseTranslationTable(":<Key>Return: no-op(RingBell)"));

	/* Xnum label. */
	n = m;
	XtSetArg(args[n], XtNlabel, "Xnum");						n++;
	XtSetArg(args[n], XtNborderWidth, 0);						n++;
	XtSetArg(args[n], XtNfromVert, arealight_intensity_text);	n++;
	labels[1] = XtCreateManagedWidget("arealightXnumLabel",
									  labelWidgetClass, form, args, n);

	/* Xnum text. */
	n = m;
	XtSetArg(args[n], XtNeditType, XawtextEdit);		n++;
	XtSetArg(args[n], XtNlength, MAX_STRING_LENGTH);	n++;
	XtSetArg(args[n], XtNuseStringInPlace, TRUE);		n++;
	XtSetArg(args[n], XtNstring, xnum_string);			n++;
	XtSetArg(args[n], XtNfromHoriz, labels[1]);			n++;
	XtSetArg(args[n], XtNfromVert, arealight_intensity_text);	n++;
	xnum_text = XtCreateManagedWidget("arealightXnumText",
					asciiTextWidgetClass, form, args, n);
	XtOverrideTranslations(xnum_text,
		XtParseTranslationTable(":<Key>Return: no-op(RingBell)"));

	/* Ynum label. */
	n = m;
	XtSetArg(args[n], XtNlabel, "Ynum");		n++;
	XtSetArg(args[n], XtNborderWidth, 0);		n++;
	XtSetArg(args[n], XtNfromVert, xnum_text);	n++;
	labels[2] = XtCreateManagedWidget("arealightYnumLabel",
									  labelWidgetClass, form, args, n);

	/* Ynum text. */
	n = m;
	XtSetArg(args[n], XtNeditType, XawtextEdit);		n++;
	XtSetArg(args[n], XtNlength, MAX_STRING_LENGTH);	n++;
	XtSetArg(args[n], XtNuseStringInPlace, TRUE);		n++;
	XtSetArg(args[n], XtNstring, ynum_string);			n++;
	XtSetArg(args[n], XtNfromHoriz, labels[2]);			n++;
	XtSetArg(args[n], XtNfromVert, xnum_text);			n++;
	ynum_text = XtCreateManagedWidget("arealightYnumText",
					asciiTextWidgetClass, form, args, n);
	XtOverrideTranslations(ynum_text,
		XtParseTranslationTable(":<Key>Return: no-op(RingBell)"));

	Match_Widths(labels, 3);

	/* The jitter toggle. */
	n = m;
	XtSetArg(args[n], XtNlabel, "Jitter");		n++;
	XtSetArg(args[n], XtNfromVert, ynum_text);	n++;
	jitter_toggle = XtCreateManagedWidget("arealightJitterToggle",
						toggleWidgetClass, form, args, n);

	/* Done and cancel. */
	n = m;
	XtSetArg(args[n], XtNlabel, "Done");			n++;
	XtSetArg(args[n], XtNfromVert, jitter_toggle);	n++;
#if ( USE_ROUNDED_BUTTONS == 1 )
	XtSetArg(args[n], XtNshapeStyle, XmuShapeRoundedRectangle);	n++;
	XtSetArg(args[n], XtNcornerRoundPercent, 30);	n++;
	XtSetArg(args[n], XtNhighlightThickness, 2);	n++;
#endif
	done = XtCreateManagedWidget("arealightDoneCommand", commandWidgetClass,
								 form, args, n);
	XtAddCallback(done, XtNcallback, Arealight_Attributes_Callback, NULL);

	n = m;
	XtSetArg(args[n], XtNlabel, "Cancel");			n++;
	XtSetArg(args[n], XtNfromVert, jitter_toggle);	n++;
	XtSetArg(args[n], XtNfromHoriz, done);			n++;
#if ( USE_ROUNDED_BUTTONS == 1 )
	XtSetArg(args[n], XtNshapeStyle, XmuShapeRoundedRectangle);	n++;
	XtSetArg(args[n], XtNcornerRoundPercent, 30);	n++;
	XtSetArg(args[n], XtNhighlightThickness, 2);	n++;
#endif
	cancel = XtCreateManagedWidget("arealightCancelCommand", commandWidgetClass,
								   form, args, n);
	XtAddCallback(cancel, XtNcallback, Cancel_Light_Callback,
				  (XtPointer)arealight_shell);

	XtRealizeWidget(arealight_shell);
}
Exemplo n.º 12
0
void create_print_panel(Widget w)
{
	Widget	    image;
	Widget	    entry,mag_spinner, below, fitpage;
	Pixmap	    p;
	unsigned    long fg, bg;
	char	   *printer_val;
	char	    buf[100];
	char	   *unit;
	int	    ux,uy,lx,ly;
	int	    i,len,maxl;
	float	    mult;

	XtTranslateCoords(tool, (Position) 0, (Position) 0, &xposn, &yposn);

	FirstArg(XtNx, xposn+50);
	NextArg(XtNy, yposn+50);
	NextArg(XtNtitle, "Xfig: Print menu");
	NextArg(XtNcolormap, tool_cm);
	print_popup = XtCreatePopupShell("print_popup",
					 transientShellWidgetClass,
					 tool, Args, ArgCount);
        XtOverrideTranslations(print_popup,
                           XtParseTranslationTable(prn_translations));
        XtAppAddActions(tool_app, prn_actions, XtNumber(prn_actions));

	print_panel = XtCreateManagedWidget("print_panel", formWidgetClass,
					    print_popup, NULL, ZERO);

	/* start with the picture of the printer */

	FirstArg(XtNlabel, "   ");
	NextArg(XtNwidth, printer_ic.width);
	NextArg(XtNheight, printer_ic.height);
	NextArg(XtNborderWidth, 0);
	NextArg(XtNinternalWidth, 0);
	NextArg(XtNinternalHeight, 0);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	image = XtCreateManagedWidget("printer_image", labelWidgetClass,
				      print_panel, Args, ArgCount);
	FirstArg(XtNforeground, &fg);
	NextArg(XtNbackground, &bg);
	GetValues(image);
	p = XCreatePixmapFromBitmapData(tool_d, XtWindow(canvas_sw),
		      printer_ic.bits, printer_ic.width, printer_ic.height,
		      fg, bg, tool_dpth);
	FirstArg(XtNbitmap, p);
	SetValues(image);

	FirstArg(XtNlabel, "Print to PostScript Printer");
	NextArg(XtNfromHoriz, image);
	NextArg(XtNborderWidth, 0);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	(void) XtCreateManagedWidget("print_label", labelWidgetClass,
					print_panel, Args, ArgCount);

	FirstArg(XtNlabel, " Magnification %");
	NextArg(XtNfromVert, image);
	NextArg(XtNborderWidth, 0);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	beside = XtCreateManagedWidget("mag_label", labelWidgetClass,
					print_panel, Args, ArgCount);

	/* make a spinner entry for the mag */
	/* note: this was called "magnification" */
	sprintf(buf, "%.1f", appres.magnification);
	mag_spinner = MakeFloatSpinnerEntry(print_panel, &print_mag_text, "magnification",
				image, beside, update_mag, buf, 0.0, 10000.0, 1.0, 45);

	/* we want to track typing here to update figure size label */

	XtOverrideTranslations(print_mag_text,
			       XtParseTranslationTable(print_translations));

	/* Fit Page to the right of the magnification window */

	FirstArg(XtNlabel, "Fit to Page");
	NextArg(XtNfromVert, image);
	NextArg(XtNfromHoriz, mag_spinner);
	NextArg(XtNborderWidth, INTERNAL_BW);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	fitpage = XtCreateManagedWidget("fitpage", commandWidgetClass,
				       print_panel, Args, ArgCount);
	XtAddEventHandler(fitpage, ButtonReleaseMask, False,
			  (XtEventHandler)fit_page, (XtPointer) NULL);

	/* Figure Size to the right of the fit page window */

	mult = appres.INCHES? PIX_PER_INCH : PIX_PER_CM;
	unit = appres.INCHES? "in": "cm";
	/* get the size of the figure */
	compound_bound(&objects, &lx, &ly, &ux, &uy);
	sprintf(buf, "Fig Size: %.1f%s x %.1f%s      ",
		(float)(ux-lx)/mult*appres.magnification/100.0,unit,
		(float)(uy-ly)/mult*appres.magnification/100.0,unit);
	FirstArg(XtNlabel, buf);
	NextArg(XtNfromVert, image);
	NextArg(XtNfromHoriz, fitpage);
	NextArg(XtNhorizDistance, 5);
	NextArg(XtNborderWidth, 0);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	size_lab = XtCreateManagedWidget("size_label", labelWidgetClass,
					print_panel, Args, ArgCount);

	/* paper size */

	FirstArg(XtNlabel, "      Paper Size");
	NextArg(XtNborderWidth, 0);
	NextArg(XtNfromVert, fitpage);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	beside = XtCreateManagedWidget("papersize_label", labelWidgetClass,
					 print_panel, Args, ArgCount);

	FirstArg(XtNlabel, paper_sizes[appres.papersize].fname);
	NextArg(XtNfromHoriz, beside);
	NextArg(XtNfromVert, fitpage);
	NextArg(XtNborderWidth, INTERNAL_BW);
	NextArg(XtNresizable, True);
	NextArg(XtNrightBitmap, menu_arrow);	/* use menu arrow for pull-down */
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	print_papersize_panel = XtCreateManagedWidget("papersize",
					   menuButtonWidgetClass,
					   print_panel, Args, ArgCount);
	papersize_menu = XtCreatePopupShell("menu", simpleMenuWidgetClass, 
				    print_papersize_panel, NULL, ZERO);

	/* make the menu items */
	for (i = 0; i < XtNumber(paper_sizes); i++) {
	    entry = XtCreateManagedWidget(paper_sizes[i].fname, smeBSBObjectClass, 
					papersize_menu, NULL, ZERO);
	    XtAddCallback(entry, XtNcallback, papersize_select, (XtPointer) i);
	}

	/* Orientation */

	FirstArg(XtNlabel, "     Orientation");
	NextArg(XtNborderWidth, 0);
	NextArg(XtNfromVert, print_papersize_panel);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	beside = XtCreateManagedWidget("orient_label", labelWidgetClass,
					   print_panel, Args, ArgCount);

	FirstArg(XtNfromHoriz, beside);
	NextArg(XtNfromVert, print_papersize_panel);
	NextArg(XtNborderWidth, INTERNAL_BW);
	NextArg(XtNleftBitmap, menu_arrow);	/* use menu arrow for pull-down */
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	print_orient_panel = XtCreateManagedWidget(orient_items[appres.landscape],
					     menuButtonWidgetClass,
					     print_panel, Args, ArgCount);
	make_pulldown_menu(orient_items, XtNumber(orient_items), -1, "",
				      print_orient_panel, orient_select);

	FirstArg(XtNlabel, "Justification");
	NextArg(XtNborderWidth, 0);
	NextArg(XtNfromHoriz, print_orient_panel);
	NextArg(XtNfromVert, print_papersize_panel);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	just_lab = XtCreateManagedWidget("just_label", labelWidgetClass,
					 print_panel, Args, ArgCount);

	FirstArg(XtNlabel, just_items[appres.flushleft? 1 : 0]);
	NextArg(XtNfromHoriz, just_lab);
	NextArg(XtNfromVert, print_papersize_panel);
	NextArg(XtNborderWidth, INTERNAL_BW);
	NextArg(XtNleftBitmap, menu_arrow);	/* use menu arrow for pull-down */
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	print_just_panel = XtCreateManagedWidget("justify",
					   menuButtonWidgetClass,
					   print_panel, Args, ArgCount);
	make_pulldown_menu(just_items, XtNumber(just_items), -1, "",
				    print_just_panel, just_select);

	/* multiple/single page */

	FirstArg(XtNlabel, "           Pages");
	NextArg(XtNborderWidth, 0);
	NextArg(XtNfromVert, print_just_panel);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	beside = XtCreateManagedWidget("multiple_label", labelWidgetClass,
					 print_panel, Args, ArgCount);

	FirstArg(XtNlabel, multiple_pages[appres.multiple? 1:0]);
	NextArg(XtNfromHoriz, beside);
	NextArg(XtNfromVert, print_just_panel);
	NextArg(XtNborderWidth, INTERNAL_BW);
	NextArg(XtNleftBitmap, menu_arrow);	/* use menu arrow for pull-down */
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	print_multiple_panel = XtCreateManagedWidget("multiple_pages",
					   menuButtonWidgetClass,
					   print_panel, Args, ArgCount);
	make_pulldown_menu(multiple_pages, XtNumber(multiple_pages), -1, "",
				    print_multiple_panel, multiple_select);

	FirstArg(XtNlabel, overlap_pages[appres.overlap? 1:0]);
	NextArg(XtNfromHoriz, print_multiple_panel);
	NextArg(XtNfromVert, print_just_panel);
	NextArg(XtNborderWidth, INTERNAL_BW);
	NextArg(XtNleftBitmap, menu_arrow);	/* use menu arrow for pull-down */
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	print_overlap_panel = XtCreateManagedWidget("overlap_pages",
					   menuButtonWidgetClass,
					   print_panel, Args, ArgCount);
	make_pulldown_menu(overlap_pages, XtNumber(overlap_pages), -1, "",
				    print_overlap_panel, overlap_select);

	/* background color */

	FirstArg(XtNlabel, "Background");
	NextArg(XtNfromHoriz, print_overlap_panel);
	NextArg(XtNfromVert, print_just_panel);
	NextArg(XtNborderWidth, 0);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	beside = XtCreateManagedWidget("background_label", labelWidgetClass,
					 print_panel, Args, ArgCount);

	FirstArg(XtNfromHoriz, beside);
	NextArg(XtNfromVert, print_just_panel);
	NextArg(XtNresize, False);
	NextArg(XtNwidth, 80);
	NextArg(XtNborderWidth, INTERNAL_BW);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	print_background_panel = XtCreateManagedWidget("background",
					   menuButtonWidgetClass,
					   print_panel, Args, ArgCount);

	/* now set the color and name in the background button */
	set_but_col(print_background_panel, export_background_color);

	/* make color menu */
	background_menu = make_color_popup_menu(print_background_panel, 
					"Background Color", background_select,
					NO_TRANSP, INCL_BACKG);
	/* grid options */
	FirstArg(XtNlabel, "            Grid");
	NextArg(XtNfromVert, print_background_panel);
	NextArg(XtNborderWidth, 0);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	beside = XtCreateManagedWidget("grid_label", labelWidgetClass,
					    print_panel, Args, ArgCount);
	below = make_grid_options(print_panel, print_background_panel, beside, minor_grid, major_grid,
				&print_grid_minor_menu_button, &print_grid_major_menu_button,
				&print_grid_minor_menu, &print_grid_major_menu,
				&print_grid_minor_text, &print_grid_major_text,
				&print_grid_unit_label,
				print_grid_major_select, print_grid_minor_select);

	/* printer name */

	FirstArg(XtNlabel, "         Printer");
	NextArg(XtNfromVert, below);
	NextArg(XtNborderWidth, 0);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	beside = XtCreateManagedWidget("printer_label", labelWidgetClass,
					    print_panel, Args, ArgCount);
	/*
	 * don't SetValue the XtNstring so the user may specify the default
	 * printer in a resource, e.g.:	 *printer*string: at6
	 */

	FirstArg(XtNwidth, 200);
	NextArg(XtNleftMargin, 4);
	NextArg(XtNfromVert, below);
	NextArg(XtNfromHoriz, beside);
	NextArg(XtNeditType, XawtextEdit);
	NextArg(XtNinsertPosition, 0);
	NextArg(XtNborderWidth, INTERNAL_BW);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	printer_text = XtCreateManagedWidget("printer", asciiTextWidgetClass,
					     print_panel, Args, ArgCount);

	XtOverrideTranslations(printer_text,
			       XtParseTranslationTable(print_translations));

	/* put the printer name in the label if resource isn't set */
	FirstArg(XtNstring, &printer_val);
	GetValues(printer_text);
	/* no printer name specified in resources, get PRINTER environment
	   var and put it into the widget */
	if (emptyname(printer_val)) {
		printer_val=getenv("PRINTER");
		if ((printer_val!=NULL) && strchr(printer_val,'\\')) {
		    buf[0]='\0';
		    len=0;
		    for (i=0; i<strlen(printer_val); i++) {
		    	buf[len++] = printer_val[i];
		    	if (printer_val[i]=='\\')
			    buf[len++]='\\';
		    }
		    buf[len++]='\0';
		    printer_val = buf;
		}
		if (printer_val == NULL) {
			printer_val = "";
		} else {
			FirstArg(XtNstring, printer_val);
			SetValues(printer_text);
		}
	}
	/* parse /etc/printcap for printernames for the pull-down menu */
	numprinters = parse_printcap(printer_names);
	/* find longest name */
	maxl = 0;
	for (i=0; i<numprinters; i++) {
	    len=strlen(printer_names[i]);
	    if (len > maxl) {
		maxl = len;
	    }
	}
	/* make string of blanks the length of the longest printer name */
	buf[0] = '\0';
	for (i=0; i<maxl; i++)
	    strcat(buf," ");
	if (numprinters > 0) {
	    FirstArg(XtNlabel, buf);
	    NextArg(XtNfromHoriz, printer_text);
	    NextArg(XtNfromVert, below);
	    NextArg(XtNborderWidth, INTERNAL_BW);
	    NextArg(XtNleftBitmap, menu_arrow);	/* use menu arrow for pull-down */
	    NextArg(XtNtop, XtChainTop);
	    NextArg(XtNbottom, XtChainTop);
	    NextArg(XtNleft, XtChainLeft);
	    NextArg(XtNright, XtChainLeft);
	    printer_menu_button = XtCreateManagedWidget("printer_names",
					   menuButtonWidgetClass,
					   print_panel, Args, ArgCount);
	    make_pulldown_menu(printer_names, numprinters, -1, "",
				    printer_menu_button, printer_select);
	}

	FirstArg(XtNlabel, "Print Job Params");
	NextArg(XtNfromVert, printer_text);
	NextArg(XtNborderWidth, 0);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	beside = XtCreateManagedWidget("job_params_label", labelWidgetClass,
					    print_panel, Args, ArgCount);
	/*
	 * don't SetValue the XtNstring so the user may specify the default
	 * job parameters in a resource, e.g.:	 *param*string: -K2
	 */

	FirstArg(XtNwidth, 200);
	NextArg(XtNfromVert, printer_text);
	NextArg(XtNfromHoriz, beside);
	NextArg(XtNeditType, XawtextEdit);
	NextArg(XtNinsertPosition, 0);
	NextArg(XtNborderWidth, INTERNAL_BW);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	param_text = XtCreateManagedWidget("job_params", asciiTextWidgetClass,
					     print_panel, Args, ArgCount);

	XtOverrideTranslations(param_text,
			       XtParseTranslationTable(print_translations));

	FirstArg(XtNlabel, "Figures in batch");
	NextArg(XtNfromVert, param_text);
	NextArg(XtNborderWidth, 0);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	beside = XtCreateManagedWidget("num_batch_label", labelWidgetClass,
					    print_panel, Args, ArgCount);
	FirstArg(XtNwidth, 30);
	NextArg(XtNlabel, "  0");
	NextArg(XtNfromVert, param_text);
	NextArg(XtNfromHoriz, beside);
	NextArg(XtNborderWidth, INTERNAL_BW);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	num_batch = XtCreateManagedWidget("num_batch", labelWidgetClass,
					     print_panel, Args, ArgCount);

	FirstArg(XtNlabel, "Dismiss");
	NextArg(XtNfromVert, num_batch);
	NextArg(XtNvertDistance, 10);
	NextArg(XtNhorizDistance, 6);
	NextArg(XtNheight, 35);
	NextArg(XtNborderWidth, INTERNAL_BW);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	dismiss = XtCreateManagedWidget("dismiss", commandWidgetClass,
				       print_panel, Args, ArgCount);
	XtAddEventHandler(dismiss, ButtonReleaseMask, False,
			  (XtEventHandler)print_panel_dismiss, (XtPointer) NULL);

	/* radio for printing all layers */

	beside = make_layer_choice("Print all layers ", "Print only active",
				print_panel, num_batch, dismiss, 6, 6);

	/* print buttons */

	FirstArg(XtNlabel, "Print FIGURE\nto Printer");
	NextArg(XtNfromVert, num_batch);
	NextArg(XtNfromHoriz, beside);
	NextArg(XtNresize, False);	/* must not allow resize because the label changes */
	NextArg(XtNheight, 35);
	NextArg(XtNborderWidth, INTERNAL_BW);
	NextArg(XtNvertDistance, 10);
	NextArg(XtNhorizDistance, 6);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	print = XtCreateManagedWidget("print", commandWidgetClass,
				      print_panel, Args, ArgCount);
	XtAddEventHandler(print, ButtonReleaseMask, False,
			  (XtEventHandler)do_print, (XtPointer) NULL);

	FirstArg(XtNlabel, "Print FIGURE\nto Batch");
	NextArg(XtNfromVert, num_batch);
	NextArg(XtNfromHoriz, print);
	NextArg(XtNheight, 35);
	NextArg(XtNborderWidth, INTERNAL_BW);
	NextArg(XtNvertDistance, 10);
	NextArg(XtNhorizDistance, 6);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	print_batch = XtCreateManagedWidget("print_batch", commandWidgetClass,
				      print_panel, Args, ArgCount);
	XtAddEventHandler(print_batch, ButtonReleaseMask, False,
			  (XtEventHandler)do_print_batch, (XtPointer) NULL);

	FirstArg(XtNlabel, "Clear\nBatch");
	NextArg(XtNfromVert, num_batch);
	NextArg(XtNfromHoriz, print_batch);
	NextArg(XtNheight, 35);
	NextArg(XtNborderWidth, INTERNAL_BW);
	NextArg(XtNvertDistance, 10);
	NextArg(XtNhorizDistance, 6);
	NextArg(XtNtop, XtChainTop);
	NextArg(XtNbottom, XtChainTop);
	NextArg(XtNleft, XtChainLeft);
	NextArg(XtNright, XtChainLeft);
	clear_batch = XtCreateManagedWidget("clear_batch", commandWidgetClass,
				      print_panel, Args, ArgCount);
	XtAddEventHandler(clear_batch, ButtonReleaseMask, False,
			  (XtEventHandler)do_clear_batch, (XtPointer) NULL);

	/* install accelerators for the following functions */
	XtInstallAccelerators(print_panel, dismiss);
	XtInstallAccelerators(print_panel, print_batch);
	XtInstallAccelerators(print_panel, clear_batch);
	XtInstallAccelerators(print_panel, print);
	update_batch_count();

	/* if multiple pages is on, desensitive justification panels */
	if (appres.multiple) {
	    XtSetSensitive(just_lab, False);
	    XtSetSensitive(print_just_panel, False);
	    if (export_just_panel) {
	        XtSetSensitive(just_lab, False);
	        XtSetSensitive(export_just_panel, False);
	    }
	} else {
	    XtSetSensitive(just_lab, True);
	    XtSetSensitive(print_just_panel, True);
	    if (export_just_panel) {
	        XtSetSensitive(just_lab, True);
	        XtSetSensitive(export_just_panel, True);
	    }
	}
}
Exemplo n.º 13
0
/**************************************************************************
 Show the Citizen Management Agent Dialog for the current city.
**************************************************************************/
void show_cma_dialog(struct city *pcity, Widget citydlg)
{
  Widget add_button, remove_button, help_button;
  Widget form, preset_viewport, close_button;
  Widget surplus_header, factor_header, prev;
  struct cm_parameter parameter;
  struct cm_result *result = cm_result_new(pcity);
  int i;

  current_city = pcity;
  stat_surplus_label = fc_malloc((O_LAST + 1) * sizeof(Widget));
  stat_factor_label = fc_malloc((O_LAST + 1) * sizeof(Widget));

  cma_dialog = 
    I_T(XtCreatePopupShell("cmapopup",
                           topLevelShellWidgetClass,
                           citydlg, NULL, 0));

  form = 
    XtVaCreateManagedWidget("cmaform",
                            formWidgetClass,
                            cma_dialog, NULL);

  preset_viewport = 
    XtVaCreateManagedWidget("cmapresetviewport",
                            viewportWidgetClass, form,
                            NULL);

  preset_list = 
    XtVaCreateManagedWidget("cmapresetlist",
                            listWidgetClass, preset_viewport,
                            XtNlist, (XtArgVal)initial_preset_list,
                            NULL);

  result_label = 
    I_L(XtVaCreateManagedWidget("cmaresultlabel",
                                labelWidgetClass, form,
                                XtNfromHoriz, preset_viewport,
                                NULL));

  surplus_header = 
    I_L(XtVaCreateManagedWidget("cmasurpluslabel",
                                labelWidgetClass, form,
                                XtNfromHoriz, preset_viewport,
                                XtNfromVert, result_label,
                                NULL));

  /* Create labels in the minimal surplus column. */
  prev = surplus_header;
  for (i = 0; i < (O_LAST + 1); i++) {
    I_L(stat_surplus_label[i] = 
        XtVaCreateManagedWidget("cmastatlabel",
                                labelWidgetClass, form,
                                XtNfromHoriz, preset_viewport,
                                XtNfromVert, prev,
                                XtNvertDistance, 1,
                                XtNlabel, (i == O_LAST) ? 
                                  _("Celebrate") : get_output_name(i),
                                NULL));
    prev = stat_surplus_label[i];
  }

  /* Create scrollbars in the minimal surplus column. */
  prev = surplus_header;
  output_type_iterate(i) {
    surplus_slider[i] = 
      XtVaCreateManagedWidget("cmapresetscroll",
                                  scrollbarWidgetClass, form,
                                  XtNfromHoriz, stat_surplus_label[i],
                                  XtNfromVert, prev,
                                  NULL);
    prev = stat_surplus_label[i];
  } output_type_iterate_end;

  celebrate_toggle = 
    I_L(XtVaCreateManagedWidget("cmapresettoggle",
                                toggleWidgetClass,form,
                                XtNfromHoriz, stat_surplus_label[0],
                                XtNfromVert, stat_surplus_label[O_LAST - 1],
                                NULL));

  /* Create header label in the factor column. */
  factor_header = 
    I_L(XtVaCreateManagedWidget("cmafactorlabel",
                                labelWidgetClass, form,
                                XtNfromHoriz, surplus_slider[0],
                                XtNfromVert, result_label,
                                NULL));

  /* Create stat labels in the factor column. */
  prev = factor_header;
  for (i = 0; i < (O_LAST + 1); i++) {
    I_L(stat_factor_label[i] =
        XtVaCreateManagedWidget("cmastatlabel",
                                labelWidgetClass, form,
                                XtNfromHoriz, surplus_slider[0],
                                XtNfromVert, prev,
                                XtNvertDistance, 1,
                                XtNlabel, (i == O_LAST) ?
                                  _("Celebrate") : get_output_name(i),
                                NULL));
    prev = stat_factor_label[i];
  }

  /* Create scrollbars in the factor column. */
  prev = factor_header;
  for (i = 0; i < (O_LAST + 1); i++) {
    factor_slider[i] =
      XtVaCreateManagedWidget("cmapresetscroll",
                                  scrollbarWidgetClass, form,
                                  XtNfromHoriz, stat_factor_label[i],
                                  XtNfromVert, prev,
                                  NULL);
    prev = stat_factor_label[i];
  }

  close_button = 
    I_L(XtVaCreateManagedWidget("cmaclosebutton",
                                commandWidgetClass, form,
                                XtNfromVert, preset_viewport,
                                NULL));

  control_button = 
    I_L(XtVaCreateManagedWidget("cmacontrolbutton",
                                commandWidgetClass, form,
                                XtNfromVert, preset_viewport,
                                XtNfromHoriz, close_button,
                                NULL));

  release_button = 
    I_L(XtVaCreateManagedWidget("cmareleasebutton",
                                commandWidgetClass, form,
                                XtNfromVert, preset_viewport,
                                XtNfromHoriz, control_button,
                                NULL));

  change_button =
    I_L(XtVaCreateManagedWidget("cmachangebutton",
                                commandWidgetClass, form,
                                XtNfromVert, preset_viewport,
                                XtNfromHoriz, release_button,
                                NULL));

  add_button = 
   I_L(XtVaCreateManagedWidget("cmaaddbutton",
                               commandWidgetClass, form,
                               XtNfromVert, preset_viewport,
                               XtNfromHoriz, change_button,
                               NULL));

  remove_button = 
     I_L(XtVaCreateManagedWidget("cmaremovebutton",
                                 commandWidgetClass, form, 
                                 XtNfromVert, preset_viewport,
                                 XtNfromHoriz, add_button,
                                 NULL));

  help_button = 
     I_L(XtVaCreateManagedWidget("cmahelpbutton",
                                 commandWidgetClass, form,
                                 XtNfromVert, preset_viewport,
                                 XtNfromHoriz, remove_button,
                                 NULL));

  XtAddCallback(control_button, XtNcallback, control_city,
                (XtPointer)preset_list);
  XtAddCallback(release_button, XtNcallback, release_city,
                (XtPointer)preset_list);
  XtAddCallback(change_button, XtNcallback, change_callback,
                (XtPointer)preset_list);
  XtAddCallback(add_button, XtNcallback, add_preset,
                (XtPointer)preset_list);
  XtAddCallback(remove_button, XtNcallback, remove_preset,
                (XtPointer)preset_list);
  XtAddCallback(preset_list, XtNcallback, select_preset,
                (XtPointer)preset_list);
  XtAddCallback(help_button, XtNcallback, cma_help,
                (XtPointer)preset_list);
  XtAddCallback(celebrate_toggle, XtNcallback,
                celebrate_callback, NULL);
  XtAddCallback(close_button, XtNcallback,
                close_callback, NULL);

  output_type_iterate(i) {
    XtAddCallback(surplus_slider[i], XtNscrollProc,
                  sliders_scroll_callback, NULL);
    XtAddCallback(surplus_slider[i], XtNjumpProc,
                  sliders_jump_callback, NULL);
  } output_type_iterate_end;

  for (i = 0; i < (O_LAST + 1); i++) {
    XtAddCallback(factor_slider[i], XtNscrollProc,
                  sliders_scroll_callback, NULL);
    XtAddCallback(factor_slider[i], XtNjumpProc,
                  sliders_jump_callback, NULL);
  }

  /* Update dialog with CMA parameters from city.  */
  cmafec_get_fe_parameter(current_city, &parameter);

  output_type_iterate(i) {
    minimal_surplus[i] = parameter.minimal_surplus[i];
  } output_type_iterate_end;

  XtVaSetValues(celebrate_toggle, 
         XtNlabel, parameter.require_happy ? _("Yes") : _("No"),
         XtNstate, parameter.require_happy, NULL);

  if (parameter.happy_factor > 0) {
    factors[O_LAST] = parameter.happy_factor;
  } else {
    factors[O_LAST] = 1;
  }

  output_type_iterate(i) {
    factors[i] = parameter.factor[i];
  } output_type_iterate_end;

  set_slider_values();
  update_cma_preset_list();

  XtVaSetValues(preset_list, XtNwidth, 200, NULL);
  XtVaSetValues(preset_list, XtNheight, 300, NULL);
  XtVaSetValues(celebrate_toggle, XtNwidth, 30, NULL);
  XtVaSetValues(result_label, XtNwidth, 360, NULL);
  XtVaSetValues(result_label, XtNheight, 110, NULL);

  output_type_iterate(i) {
    XtVaSetValues(stat_surplus_label[i], XtNwidth, 90, NULL);
    XtVaSetValues(stat_factor_label[i], XtNwidth, 90, NULL);
  } output_type_iterate_end;
  /* FIXME! Now we assume that output_type_iterate ends with O_LAST. */
  XtVaSetValues(stat_factor_label[O_LAST], XtNwidth, 90, NULL);

  XtRealizeWidget(cma_dialog);

  update_stat_labels(True);
  cm_result_from_main_map(result, pcity);
  xaw_set_label(result_label, 
       (char *) cmafec_get_result_descr(current_city, result, &parameter));

  XSetWMProtocols(display, XtWindow(cma_dialog),
                  &wm_delete_window, 1);
  XtVaSetValues(preset_viewport, XtNforceBars, True, NULL);
  xaw_set_relative_position(citydlg, cma_dialog, 5, 5);
  XtPopup(cma_dialog, XtGrabNone);

  cm_result_destroy(result);
}
Exemplo n.º 14
0
void create_col_collector_shell (Widget parent)
{
	Widget children[27];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	Widget widget110 = (Widget)NULL;
	Widget widget111 = (Widget)NULL;
	Widget widget124 = (Widget)NULL;
	Widget widget129 = (Widget)NULL;
	Widget widget158 = (Widget)NULL;

	XtSetArg(al[ac], XmNtitle, "Arbor COL_COLLECTOR"); ac++;
	XtSetArg(al[ac], XmNiconName, "COL_COLLECTOR"); ac++;
	col_collector_shell = XtCreatePopupShell ( "col_collector_shell", topLevelShellWidgetClass, parent, al, ac );
	ac = 0;
/* begin pre-creation code */

XtVaSetValues(col_collector_shell, XmNiconPixmap, abp_icon, NULL) ;

/* end pre-creation code */

	col_collector_form = XmCreateForm ( col_collector_shell, "col_collector_form", al, ac );
	ac = 0;
	col_collector_summ_form = XmCreateForm ( col_collector_form, "col_collector_summ_form", al, ac );
	col_collector_list_label = XmCreateLabel ( col_collector_summ_form, "col_collector_list_label", al, ac );
	XtSetArg(al[ac], XmNvisibleItemCount, 8); ac++;
	col_collector_summlist = XmCreateScrolledList ( col_collector_summ_form, "col_collector_summlist", al, ac );
	ac = 0;
	widget110 = XtParent ( col_collector_summlist );

	XtSetArg(al[ac], XmNhorizontalScrollBar, &widget111 ); ac++;
	XtGetValues(widget110, al, ac );
	ac = 0;
	col_collector_list_labels2 = XmCreateLabel ( col_collector_summ_form, "col_collector_list_label2", al, ac );
	col_collector_button_form = XmCreateForm ( col_collector_form, "col_collector_button_form", al, ac );
	col_collector_save_btn = XmCreatePushButton ( col_collector_button_form, "col_collector_save_btn", al, ac );
	col_collector_clear_btn = XmCreatePushButton ( col_collector_button_form, "col_collector_clear_btn", al, ac );
	col_collector_update_btn = XmCreatePushButton ( col_collector_button_form, "col_collector_update_btn", al, ac );
	col_collector_close_btn = XmCreatePushButton ( col_collector_button_form, "col_collector_close_btn", al, ac );
	col_collector_delete_btn = XmCreatePushButton ( col_collector_button_form, "col_collector_delete_btn", al, ac );
	col_collector_scripts_btn = XmCreatePushButton ( col_collector_button_form, "col_collector_scripts_btn", al, ac );
	XtSetArg(al[ac], XmNshadowThickness, 2); ac++;
	col_collector_tgl_form = XmCreateForm ( col_collector_form, "col_collector_tgl_form", al, ac );
	ac = 0;
	col_collector_edit_mode_label = XmCreateLabel ( col_collector_tgl_form, "col_collector_edit_mode_label", al, ac );
	XtSetArg(al[ac], XmNnumColumns, 3); ac++;
	XtSetArg(al[ac], XmNpacking, XmPACK_TIGHT); ac++;
	widget124 = XmCreateRadioBox ( col_collector_tgl_form, "widget124", al, ac );
	ac = 0;
	col_collector_create_toggle = XmCreateToggleButtonGadget ( widget124, "col_collector_create_toggle", al, ac );
	col_collector_modify_toggle = XmCreateToggleButtonGadget ( widget124, "col_collector_modify_toggle", al, ac );
	col_collector_delete_toggle = XmCreateToggleButtonGadget ( widget124, "col_collector_delete_toggle", al, ac );
	col_collector_view_toggle = XmCreateToggleButtonGadget ( widget124, "col_collector_view_toggle", al, ac );
	widget129 = XmCreateForm ( col_collector_form, "widget129", al, ac );
	XtSetArg(al[ac], XmNshadowThickness, 2); ac++;
	col_collector_detailform = XmCreateForm ( widget129, "col_collector_detailform", al, ac );
	ac = 0;
	col_collector_collector_id_label = XmCreateLabel ( col_collector_detailform, "col_collector_collector_id_label", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 5); ac++;
	XtSetArg(al[ac], XmNcolumns, 7); ac++;
	col_collector_collector_id_text = XmCreateText ( col_collector_detailform, "col_collector_collector_id_text", al, ac );
	ac = 0;
	col_collector_group_id_label = XmCreateLabel ( col_collector_detailform, "col_collector_group_id_label", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 5); ac++;
	XtSetArg(al[ac], XmNcolumns, 7); ac++;
	col_collector_group_id_text = XmCreateText ( col_collector_detailform, "col_collector_group_id_text", al, ac );
	ac = 0;
	col_collector_group_id_btn = XmCreatePushButton ( col_collector_detailform, "col_collector_group_id_btn", al, ac );
	col_collector_first_name_label = XmCreateLabel ( col_collector_detailform, "col_collector_first_name_label", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 28); ac++;
	XtSetArg(al[ac], XmNcolumns, 31); ac++;
	col_collector_first_name_text = XmCreateText ( col_collector_detailform, "col_collector_first_name_text", al, ac );
	ac = 0;
	col_collector_last_name_label = XmCreateLabel ( col_collector_detailform, "col_collector_last_name_label", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 28); ac++;
	col_collector_last_name_text = XmCreateText ( col_collector_detailform, "col_collector_last_name_text", al, ac );
	ac = 0;
	col_collector_company_label = XmCreateLabel ( col_collector_detailform, "col_collector_company_label", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 75); ac++;
	XtSetArg(al[ac], XmNcolumns, 79); ac++;
	col_collector_company_text = XmCreateText ( col_collector_detailform, "col_collector_company_text", al, ac );
	ac = 0;
	col_collector_address1_label = XmCreateLabel ( col_collector_detailform, "col_collector_address1_label", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 75); ac++;
	XtSetArg(al[ac], XmNcolumns, 79); ac++;
	col_collector_address1_text = XmCreateText ( col_collector_detailform, "col_collector_address1_text", al, ac );
	ac = 0;
	col_collector_address2_label = XmCreateLabel ( col_collector_detailform, "col_collector_address2_label", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 75); ac++;
	XtSetArg(al[ac], XmNcolumns, 79); ac++;
	col_collector_address2_text = XmCreateText ( col_collector_detailform, "col_collector_address2_text", al, ac );
	ac = 0;
	col_collector_address3_label = XmCreateLabel ( col_collector_detailform, "col_collector_address3_label", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 75); ac++;
	XtSetArg(al[ac], XmNcolumns, 79); ac++;
	col_collector_address3_text = XmCreateText ( col_collector_detailform, "col_collector_address3_text", al, ac );
	ac = 0;
	col_collector_city_label = XmCreateLabel ( col_collector_detailform, "col_collector_city_label", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 26); ac++;
	XtSetArg(al[ac], XmNcolumns, 26); ac++;
	col_collector_city_text = XmCreateText ( col_collector_detailform, "col_collector_city_text", al, ac );
	ac = 0;
	col_collector_state_label = XmCreateLabel ( col_collector_detailform, "col_collector_state_label", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 28); ac++;
	XtSetArg(al[ac], XmNcolumns, 27); ac++;
	col_collector_state_text = XmCreateText ( col_collector_detailform, "col_collector_state_text", al, ac );
	ac = 0;
	col_collector_zip_label = XmCreateLabel ( col_collector_detailform, "col_collector_zip_label", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 16); ac++;
	XtSetArg(al[ac], XmNcolumns, 26); ac++;
	col_collector_zip_text = XmCreateText ( col_collector_detailform, "col_collector_zip_text", al, ac );
	ac = 0;
	col_collector_phone_label = XmCreateLabel ( col_collector_detailform, "col_collector_phone_label", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 20); ac++;
	XtSetArg(al[ac], XmNcolumns, 26); ac++;
	col_collector_phone_text = XmCreateText ( col_collector_detailform, "col_collector_phone_text", al, ac );
	ac = 0;
	col_collector_active_flag_label = XmCreateLabel ( col_collector_detailform, "col_collector_active_flag_label", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 1); ac++;
	XtSetArg(al[ac], XmNcolumns, 2); ac++;
	col_collector_active_flag_text = XmCreateText ( col_collector_detailform, "col_collector_active_flag_text", al, ac );
	ac = 0;
	widget158 = XmCreateLabel ( widget129, "mps_detail_label", al, ac );

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 50); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -228); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -704); ac++;
	XtSetValues ( col_collector_summ_form,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 4); ac++;
	XtSetArg(al[ac], XmNtopWidget, widget129); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 4); ac++;
	XtSetValues ( col_collector_button_form,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 8); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -48); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -432); ac++;
	XtSetValues ( col_collector_tgl_form,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 4); ac++;
	XtSetArg(al[ac], XmNtopWidget, col_collector_summ_form); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -532); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 4); ac++;
	XtSetValues ( widget129,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -16); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 4); ac++;
	XtSetValues ( col_collector_list_label,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 35); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 4); ac++;
	XtSetValues ( widget110,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 16); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 4); ac++;
	XtSetValues ( col_collector_list_labels2,al, ac );
	ac = 0;
	XtAddCallback (col_collector_summlist, XmNsingleSelectionCallback, col_collector_summlist_cb,NULL);
	XtManageChild(col_collector_summlist);
	children[ac++] = col_collector_list_label;
	children[ac++] = col_collector_list_labels2;
	XtManageChildren(children, ac);
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNleftPosition, 8); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNrightPosition, 23); ac++;
	XtSetValues ( col_collector_save_btn,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNleftPosition, 31); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNrightPosition, 46); ac++;
	XtSetValues ( col_collector_clear_btn,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNleftPosition, 8); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNrightPosition, 23); ac++;
	XtSetValues ( col_collector_update_btn,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNleftPosition, 77); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNrightPosition, 92); ac++;
	XtSetValues ( col_collector_close_btn,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNleftPosition, 8); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNrightPosition, 23); ac++;
	XtSetValues ( col_collector_delete_btn,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNleftPosition, 54); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNrightPosition, 69); ac++;
	XtSetValues ( col_collector_scripts_btn,al, ac );
	ac = 0;
	XtAddCallback (col_collector_save_btn, XmNactivateCallback, col_collector_save_btn_cb,NULL);
	XtAddCallback (col_collector_clear_btn, XmNactivateCallback, col_collector_clear_btn_cb,NULL);
	XtAddCallback (col_collector_update_btn, XmNactivateCallback, col_collector_update_btn_cb,NULL);
	XtAddCallback (col_collector_close_btn, XmNactivateCallback, col_collector_close_btn_cb,NULL);
	XtAddCallback (col_collector_delete_btn, XmNactivateCallback, col_collector_delete_btn_cb,col_collector_shell);
	XtAddCallback (col_collector_scripts_btn, XmNactivateCallback, col_collector_scripts_btn_cb,col_collector_shell);
	children[ac++] = col_collector_save_btn;
	children[ac++] = col_collector_clear_btn;
	children[ac++] = col_collector_update_btn;
	children[ac++] = col_collector_close_btn;
	children[ac++] = col_collector_delete_btn;
	children[ac++] = col_collector_scripts_btn;
	XtManageChildren(children, ac);
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 4); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -36); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -92); ac++;
	XtSetValues ( col_collector_edit_mode_label,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 4); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -36); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 92); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -424); ac++;
	XtSetValues ( widget124,al, ac );
	ac = 0;
	XtAddCallback (col_collector_create_toggle, XmNarmCallback, col_collector_create_toggle_cb,NULL);
	XtAddCallback (col_collector_modify_toggle, XmNarmCallback, col_collector_modify_toggle_cb,NULL);
	XtAddCallback (col_collector_delete_toggle, XmNarmCallback, col_collector_delete_toggle_cb,NULL);
	XtAddCallback (col_collector_view_toggle, XmNarmCallback, col_collector_view_toggle_cb,NULL);
	children[ac++] = col_collector_create_toggle;
	children[ac++] = col_collector_modify_toggle;
	children[ac++] = col_collector_delete_toggle;
	children[ac++] = col_collector_view_toggle;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = col_collector_edit_mode_label;
	children[ac++] = widget124;
	XtManageChildren(children, ac);
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 24); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 4); ac++;
	XtSetValues ( col_collector_detailform,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 4); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
	XtSetValues ( widget158,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 4); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -28); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -84); ac++;
	XtSetValues ( col_collector_collector_id_label,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 4); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -28); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 84); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -148); ac++;
	XtSetValues ( col_collector_collector_id_text,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 4); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -28); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 324); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -440); ac++;
	XtSetValues ( col_collector_group_id_label,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 4); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -28); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 440); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -508); ac++;
	XtSetValues ( col_collector_group_id_text,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 4); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -28); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 508); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -532); ac++;
	XtSetValues ( col_collector_group_id_btn,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 32); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -56); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -84); ac++;
	XtSetValues ( col_collector_first_name_label,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 32); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -56); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 84); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -316); ac++;
	XtSetValues ( col_collector_first_name_text,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 32); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -56); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 324); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -440); ac++;
	XtSetValues ( col_collector_last_name_label,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 32); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -56); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 440); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -652); ac++;
	XtSetValues ( col_collector_last_name_text,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 60); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -84); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -84); ac++;
	XtSetValues ( col_collector_company_label,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 60); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -84); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 84); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -652); ac++;
	XtSetValues ( col_collector_company_text,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 88); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -112); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -84); ac++;
	XtSetValues ( col_collector_address1_label,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 88); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -112); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 84); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -652); ac++;
	XtSetValues ( col_collector_address1_text,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 116); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -140); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -84); ac++;
	XtSetValues ( col_collector_address2_label,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 116); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -140); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 84); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -652); ac++;
	XtSetValues ( col_collector_address2_text,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 144); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -168); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -84); ac++;
	XtSetValues ( col_collector_address3_label,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 144); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -168); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 84); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -652); ac++;
	XtSetValues ( col_collector_address3_text,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 172); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -196); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -84); ac++;
	XtSetValues ( col_collector_city_label,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 172); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -196); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 84); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -280); ac++;
	XtSetValues ( col_collector_city_text,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 172); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -196); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 336); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -408); ac++;
	XtSetValues ( col_collector_state_label,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 172); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -196); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 408); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -616); ac++;
	XtSetValues ( col_collector_state_text,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 200); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -224); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -84); ac++;
	XtSetValues ( col_collector_zip_label,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 200); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -224); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 84); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -280); ac++;
	XtSetValues ( col_collector_zip_text,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 228); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -252); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -84); ac++;
	XtSetValues ( col_collector_phone_label,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 228); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -252); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 84); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -280); ac++;
	XtSetValues ( col_collector_phone_text,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 228); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -252); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 336); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -408); ac++;
	XtSetValues ( col_collector_active_flag_label,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 228); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, -252); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 408); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, -440); ac++;
	XtSetValues ( col_collector_active_flag_text,al, ac );
	ac = 0;
	children[ac++] = col_collector_collector_id_label;
	children[ac++] = col_collector_collector_id_text;
	children[ac++] = col_collector_group_id_label;
	children[ac++] = col_collector_group_id_text;
	children[ac++] = col_collector_group_id_btn;
	children[ac++] = col_collector_first_name_label;
	children[ac++] = col_collector_first_name_text;
	children[ac++] = col_collector_last_name_label;
	children[ac++] = col_collector_last_name_text;
	children[ac++] = col_collector_company_label;
	children[ac++] = col_collector_company_text;
	children[ac++] = col_collector_address1_label;
	children[ac++] = col_collector_address1_text;
	children[ac++] = col_collector_address2_label;
	children[ac++] = col_collector_address2_text;
	children[ac++] = col_collector_address3_label;
	children[ac++] = col_collector_address3_text;
	children[ac++] = col_collector_city_label;
	children[ac++] = col_collector_city_text;
	children[ac++] = col_collector_state_label;
	children[ac++] = col_collector_state_text;
	children[ac++] = col_collector_zip_label;
	children[ac++] = col_collector_zip_text;
	children[ac++] = col_collector_phone_label;
	children[ac++] = col_collector_phone_text;
	children[ac++] = col_collector_active_flag_label;
	children[ac++] = col_collector_active_flag_text;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = col_collector_detailform;
	children[ac++] = widget158;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = col_collector_summ_form;
	children[ac++] = col_collector_button_form;
	children[ac++] = col_collector_tgl_form;
	children[ac++] = widget129;
	XtManageChildren(children, ac);
	ac = 0;
	XtManageChild ( col_collector_form);
}
Exemplo n.º 15
0
//
// Create the navigator widget
//
SubGraphsMotif::SubGraphsMotif(
	void *xn_parent_ctx,
	Widget	xn_parent_wid,
	const char *xn_name,
	void *xn_growctx,
	Widget *w,
	pwr_tStatus *status) :
  SubGraphs( xn_parent_ctx, xn_name, xn_growctx, status),
  parent_wid(xn_parent_wid), trace_timerid(0)	
{
  char		uid_filename[120] = "pwr_exe:ge_subgraphs.uid";
  char		*uid_filename_p = uid_filename;
  Arg 		args[20];
  pwr_tStatus	sts;
  char 		title[80];
  int		i;
  MrmHierarchy s_DRMh;
  MrmType dclass;
  char		name[] = "Proview/R Navigator";

  static MrmRegisterArg	reglist[] = {
        {(char*) "subgraphs_ctx", 0 },
	{(char*) "subgraphs_activate_exit",(caddr_t)subgraphs_activate_exit },
	{(char*) "subgraphs_activate_attr",(caddr_t)subgraphs_activate_attr },
	{(char*) "subgraphs_activate_set_extern",(caddr_t)subgraphs_activate_set_extern },
	{(char*) "subgraphs_activate_set_intern",(caddr_t)subgraphs_activate_set_intern },
	{(char*) "subgraphs_activate_help",(caddr_t)subgraphs_activate_help },
	{(char*) "subgraphs_create_sg_form",(caddr_t)subgraphs_create_sg_form }
	};
  static int	reglist_num = (sizeof reglist / sizeof reglist[0]);

  dcli_translate_filename( uid_filename, uid_filename);

  // Create object context
  reglist[0].value = (caddr_t) this;

  // Motif
  MrmInitialize();

  strcpy( title, "Loaded SubGraphs");

  // Save the context structure in the widget
  XtSetArg (args[0], XmNuserData, (XtPointer) this);

  sts = MrmOpenHierarchy( 1, &uid_filename_p, NULL, &s_DRMh);
  if (sts != MrmSUCCESS) printf("can't open %s\n", uid_filename);

  MrmRegisterNames(reglist, reglist_num);

  parent_wid = XtCreatePopupShell(title, 
		topLevelShellWidgetClass, parent_wid, args, 0);

  sts = MrmFetchWidgetOverride( s_DRMh, (char*) "subgraphs_window", parent_wid,
			name, args, 1, &toplevel, &dclass);
  if (sts != MrmSUCCESS)  printf("can't fetch %s\n", name);

  MrmCloseHierarchy(s_DRMh);

  i = 0;
  XtSetArg(args[i],XmNwidth,500);i++;
  XtSetArg(args[i],XmNheight,1200);i++;
  XtSetValues( toplevel ,args,i);
    
  XtManageChild( toplevel);

  strcpy( name, xn_name);

  form_widget = ScrolledBrowCreate( subgraphs_form,
	name, NULL, 0, 
	SubGraphs::init_brow_cb, this, (Widget *)&brow_widget);
  XtManageChild( form_widget);


  XtPopup( parent_wid, XtGrabNone);

  // Create the root item
  *w = toplevel;

  // Connect the window manager close-button to exit
  flow_AddCloseVMProtocolCb( parent_wid, 
	(XtCallbackProc)subgraphs_activate_exit, this);

  *status = 1;
}
Exemplo n.º 16
0
AttrMotif::AttrMotif(Widget a_parent_wid, void* a_parent_ctx, void* a_object,
    attr_sItem* itemlist, int item_cnt)
    : Attr(a_parent_ctx, a_object, itemlist, item_cnt),
      parent_wid(a_parent_wid), value_current_recall(0)
{
  char uid_filename[120] = { "pwr_exe:ge_attr.uid" };
  char* uid_filename_p = uid_filename;
  Arg args[20];
  pwr_tStatus sts;
  char title[80];
  int i;
  MrmHierarchy s_DRMh;
  MrmType dclass;
  char name[] = "Proview/R Navigator";

  static char translations[] = "<FocusIn>: attr_inputfocus()\n";
  static XtTranslations compiled_translations = NULL;

  static XtActionsRec actions[]
      = { { (char*)"attr_inputfocus", (XtActionProc)attr_action_inputfocus } };

  static MrmRegisterArg reglist[] = { { (char*)"attr_ctx", 0 },
    { (char*)"attr_activate_exit", (caddr_t)attr_activate_exit },
    { (char*)"attr_activate_store", (caddr_t)attr_activate_store },
    { (char*)"attr_activate_recall_prev", (caddr_t)attr_activate_recall_prev },
    { (char*)"attr_activate_recall_next", (caddr_t)attr_activate_recall_next },
    { (char*)"attr_activate_change_value",
        (caddr_t)attr_activate_change_value },
    { (char*)"attr_activate_help", (caddr_t)attr_activate_help },
    { (char*)"attr_create_msg_label", (caddr_t)attr_create_msg_label },
    { (char*)"attr_create_cmd_prompt", (caddr_t)attr_create_cmd_prompt },
    { (char*)"attr_create_cmd_input", (caddr_t)attr_create_cmd_input },
    { (char*)"attr_create_cmd_scrolledinput",
        (caddr_t)attr_create_cmd_scrolledinput },
    { (char*)"attr_create_cmd_scrolled_ok",
        (caddr_t)attr_create_cmd_scrolled_ok },
    { (char*)"attr_create_cmd_scrolled_ca",
        (caddr_t)attr_create_cmd_scrolled_ca },
    { (char*)"attr_create_attrnav_form", (caddr_t)attr_create_attrnav_form },
    { (char*)"attr_activate_cmd_scrolledinput",
        (caddr_t)attr_activate_cmd_input },
    { (char*)"attr_activate_cmd_scrolled_ok",
        (caddr_t)attr_activate_cmd_scrolled_ok },
    { (char*)"attr_activate_cmd_scrolled_ca",
        (caddr_t)attr_activate_cmd_scrolled_ca } };

  static int reglist_num = (sizeof reglist / sizeof reglist[0]);

  {
    char* s;

    if ((s = getenv("pwr_exe")) == NULL) {
      printf("** pwr_exe is not defined\n");
      exit(0);
    }
    sprintf(uid_filename, "%s/ge_attr.uid", s);
  }

  // Motif
  MrmInitialize();

  strcpy(title, "PROVIEW/R Attr");

  reglist[0].value = (caddr_t)this;

  // Save the context structure in the widget
  XtSetArg(args[0], XmNuserData, (XtPointer)this);

  sts = MrmOpenHierarchy(1, &uid_filename_p, NULL, &s_DRMh);
  if (sts != MrmSUCCESS)
    printf("can't open %s\n", uid_filename);

  MrmRegisterNames(reglist, reglist_num);

  parent_wid = XtCreatePopupShell(
      "objectEditor", topLevelShellWidgetClass, a_parent_wid, args, 0);

  sts = MrmFetchWidgetOverride(s_DRMh, (char*)"attr_window", parent_wid, name,
      args, 1, &toplevel, &dclass);
  if (sts != MrmSUCCESS)
    printf("can't fetch %s\n", name);

  MrmCloseHierarchy(s_DRMh);

  if (compiled_translations == NULL)
    XtAppAddActions(
        XtWidgetToApplicationContext(toplevel), actions, XtNumber(actions));

  if (compiled_translations == NULL)
    compiled_translations = XtParseTranslationTable(translations);
  XtOverrideTranslations(toplevel, compiled_translations);

  i = 0;
  XtSetArg(args[i], XmNwidth, 500);
  i++;
  XtSetArg(args[i], XmNheight, 700);
  i++;
  XtSetValues(toplevel, args, i);

  XtManageChild(toplevel);
  XtUnmanageChild(cmd_input);
  XtUnmanageChild(cmd_scrolledinput);
  XtUnmanageChild(cmd_scrolled_ok);
  XtUnmanageChild(cmd_scrolled_ca);

  attrnav = new AttrNavMotif(
      this, attrnav_form, "Plant", itemlist, item_cnt, &brow_widget, &sts);
  ((AttrNav*)attrnav)->message_cb = &Attr::message;
  ((AttrNav*)attrnav)->change_value_cb = &Attr::change_value_c;
  ((AttrNav*)attrnav)->get_subgraph_info_cb = &Attr::get_subgraph_info_c;
  ((AttrNav*)attrnav)->get_dyn_info_cb = &Attr::get_dyn_info_c;
  ((AttrNav*)attrnav)->reconfigure_attr_cb = &Attr::reconfigure_attr_c;
  ((AttrNav*)attrnav)->get_plant_select_cb = &Attr::get_plant_select_c;
  ((AttrNav*)attrnav)->get_current_colors_cb = &Attr::get_current_colors_c;

  XtPopup(parent_wid, XtGrabNone);

  // Connect the window manager close-button to exit
  flow_AddCloseVMProtocolCb(
      parent_wid, (XtCallbackProc)attr_activate_exit, this);
}
Exemplo n.º 17
0
/*******************************************************************************
     Name DisplayMatchedList
     Description : Called when there are more than one matches for completion
                   command
     
*******************************************************************************/
DisplayMatchedList(
Widget w,
struct symbolMatch *matches)
{
   Widget matchShell,matchForm,matchViewport,
          matchDialog,matchList,cancel;
   int n;

   if(GetMatchList(matches) == 0)
     return(0);
   matchShell = XtCreatePopupShell("Matches",
                                    topLevelShellWidgetClass,
                                    toplevel,
                                    NULL, 0);
   matchForm = XtCreateManagedWidget( "manager_form", formWidgetClass,
                                        matchShell, NULL,0);
  
  XtSetArg(args[0],XtNallowHoriz, True);
  XtSetArg(args[1],XtNallowVert, True); 
  matchViewport = XtCreateManagedWidget("manager_viewport",viewportWidgetClass,
                                        matchForm,NULL, 2);
  n = 0;
  XtSetArg(args[n],XtNlist,item_list);n++;
  matchList = XtCreateManagedWidget("manager_list",
                                       listWidgetClass,
                                       matchViewport,
                                       args,n);
  n = 0;
  XtSetArg(args[n], XtNresizable, True);n++;
  XtSetArg(args[n],XtNlabel,"");n++;
  XtSetArg(args[n], XtNvalue, "");n++;
  XtSetArg(args[n], XtNfromVert, matchViewport);n++;
  XtSetArg(args[n], XtNicon, clips_logo);n++;
  XtSetArg(args[n], XtNleft, XtChainLeft);n++;
  XtSetArg(args[n], XtNright, XtChainRight);n++;
  XtSetArg(args[n], XtNtop, XtChainBottom);n++;
  XtSetArg(args[n], XtNbottom, XtChainBottom);n++;

/* ============================================================= */
/*  If the current active window is clips dialog box then pass   */
/*  the appropriate function to handle the match for the clips   */
/*  dialog; else the funcTion handling the match for the text    */
/*  editor is passed as the callback function.                   */
/* ============================================================= */ 

  if(w == dialog_text)
   {
    matchDialog = XtCreateManagedWidget("match_dialog",
                                      dialogWidgetClass,
                                      matchForm,
                                      args, n);
    XawDialogAddButton(matchDialog, "SELECT",printMatch, (XtPointer)completionString);
   }
  else
   {
     matchDialog = XtCreateManagedWidget("match_editor",
                                      dialogWidgetClass,
                                      matchForm,
                                      args, n);
     XawDialogAddButton(matchDialog, "SELECT",printMatchForTextEdit,(XtPointer)w);
   }
  XawDialogAddButton(matchDialog, "CANCEL", CancelPopupSelect,
                     (XtPointer) matchForm);
  XtAddCallback(matchList, XtNcallback, FileToDialog, (XtPointer) matchDialog);
  XtPopup(matchShell,XtGrabNonexclusive);
}
Exemplo n.º 18
0
        actions_initted = True;
    }

    override = XtParseTranslationTable (overrideTrans);

    ac = 0;
    XtSetArg (av[ac], XtNtitle, shell_title);
    ac++;
    XtSetArg (av[ac], XtNallowShellResize, True);
    ac++;

    /* Don't allow any geometry request from the user.  */
    XtSetArg (av[ac], XtNgeometry, 0);
    ac++;

    shell = XtCreatePopupShell ("dialog", transientShellWidgetClass,
                                parent, av, ac);
    XtOverrideTranslations (shell, override);

    ac = 0;
    dialog = XtCreateManagedWidget (name, dialogWidgetClass, shell, av, ac);
    override = XtParseTranslationTable (dialogOverride);
    XtOverrideTranslations (dialog, override);

#ifdef HAVE_XFT
    {
        int num;
        Widget *ch = NULL;
        Widget w = 0;
        XtVaGetValues (dialog,
                       XtNnumChildren, &num,
                       XtNchildren, &ch, NULL);
Exemplo n.º 19
0
int
main(int argc, char *argv[])
{
    Arg args[4];
    Cardinal n;
    XtAppContext xtcontext;
    Widget parent;

    XtSetLanguageProc(NULL, NULL, NULL);

    top = XtAppInitialize( &xtcontext, "XClipboard", table, XtNumber(table),
			  &argc, argv, fallback_resources, NULL, 0);

    XtGetApplicationResources(top, (XtPointer)&userOptions, resources, 
			      XtNumber(resources), NULL, 0);

    XtAppAddActions (xtcontext,
		     xclipboard_actions, XtNumber (xclipboard_actions));
    /* CLIPBOARD_MANAGER is a non-standard mechanism */
    ManagerAtom = XInternAtom(XtDisplay(top), "CLIPBOARD_MANAGER", False);
    ClipboardAtom = XA_CLIPBOARD(XtDisplay(top));
    if (XGetSelectionOwner(XtDisplay(top), ManagerAtom))
	XtError("another clipboard is already running\n");

    parent = XtCreateManagedWidget("form", formWidgetClass, top, NULL, ZERO);
    (void) XtCreateManagedWidget("quit", Command, parent, NULL, ZERO);
    (void) XtCreateManagedWidget("delete", Command, parent, NULL, ZERO);
    (void) XtCreateManagedWidget("new", Command, parent, NULL, ZERO);
    (void) XtCreateManagedWidget("save", Command, parent, NULL, ZERO);
    nextButton = XtCreateManagedWidget("next", Command, parent, NULL, ZERO);
    prevButton = XtCreateManagedWidget("prev", Command, parent, NULL, ZERO);
    indexLabel = XtCreateManagedWidget("index", Label, parent, NULL, ZERO);

    n=0;
    XtSetArg(args[n], XtNtype, XawAsciiString); n++;
    XtSetArg(args[n], XtNeditType, XawtextEdit); n++;
    if (userOptions.wrap) {
	XtSetArg(args[n], XtNwrap, XawtextWrapWord); n++;
	XtSetArg(args[n], XtNscrollHorizontal, False); n++;
    }

    text = XtCreateManagedWidget( "text", Text, parent, args, n);
    
    currentClip = NewClip (text, (ClipPtr) 0);

    set_button_state ();

    fileDialogShell = XtCreatePopupShell("fileDialogShell",
					 transientShellWidgetClass,
					 top, NULL, ZERO);
    fileDialog = XtCreateManagedWidget ("fileDialog", dialogWidgetClass,
					fileDialogShell, NULL, ZERO);
    XawDialogAddButton(fileDialog, "accept", NULL, NULL);
    XawDialogAddButton(fileDialog, "cancel", NULL, NULL);

    failDialogShell = XtCreatePopupShell("failDialogShell",
					 transientShellWidgetClass,
					 top, NULL, ZERO);
    failDialog = XtCreateManagedWidget ("failDialog", dialogWidgetClass,
					failDialogShell, NULL, ZERO);
    XawDialogAddButton (failDialog, "continue", NULL, NULL);

    XtRealizeWidget(top);
    XtRealizeWidget(fileDialogShell);
    XtRealizeWidget(failDialogShell);
    XtOwnSelection(top, ManagerAtom, CurrentTime,
		   RefuseSelection, LoseManager, NULL);
    if (XGetSelectionOwner (XtDisplay(top), ClipboardAtom)) {
	LoseSelection (top, &ClipboardAtom);
    } else {
    	XtOwnSelection(top, ClipboardAtom, CurrentTime,
		       ConvertSelection, LoseSelection, NULL);
    }
    wm_delete_window = XInternAtom(XtDisplay(top), "WM_DELETE_WINDOW", False);
    wm_protocols = XInternAtom(XtDisplay(top), "WM_PROTOCOLS", False);
    (void) XSetWMProtocols(XtDisplay(top), XtWindow(top), &wm_delete_window,1);
    (void) XSetWMProtocols(XtDisplay(top), XtWindow(fileDialogShell),
			   &wm_delete_window,1);
    (void) XSetWMProtocols(XtDisplay(top), XtWindow(failDialogShell),
			   &wm_delete_window,1);
    XtAppMainLoop(xtcontext);
    exit(0);
}
Exemplo n.º 20
0
int
main(int argc, char **argv)
{
    char	    *file_name = NULL;
    int		    i;
    XtAppContext    xtcontext;
    Arg		    topLevelArgs[2];
    Widget          entry;

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

    toplevel = XtAppInitialize(&xtcontext, "Xditview",
			       options, XtNumber (options),
			       &argc, argv, NULL, NULL, 0);
    if (argc > 2)
	Syntax(argv[0]);

    XtAppAddActions(xtcontext, xditview_actions, XtNumber (xditview_actions));
    XtOverrideTranslations
	(toplevel, XtParseTranslationTable ("<Message>WM_PROTOCOLS: Quit()"));

    XtSetArg (topLevelArgs[0], XtNiconPixmap,
	      XCreateBitmapFromData (XtDisplay (toplevel),
				     XtScreen(toplevel)->root,
				     (char *) xdit_bits,
				     xdit_width, xdit_height));
				    
    XtSetArg (topLevelArgs[1], XtNiconMask,
	      XCreateBitmapFromData (XtDisplay (toplevel),
				     XtScreen(toplevel)->root,
				     (char *) xdit_mask_bits, 
				     xdit_mask_width, xdit_mask_height));
    XtSetValues (toplevel, topLevelArgs, 2);
    if (argc > 1)
	file_name = argv[1];

    /*
     * create the popup menu and insert the entries
     */
    popupMenu = XtCreatePopupShell ("popupMenu", simpleMenuWidgetClass, toplevel,
				    NULL, 0);
    for (i = 0; i < XtNumber (popupMenuEntries); i++) {
	entry = XtCreateManagedWidget(popupMenuEntries[i].name, 
				      smeBSBObjectClass, popupMenu,
				      NULL, (Cardinal) 0);
	XtAddCallback(entry, XtNcallback, popupMenuEntries[i].function, NULL);
    }

    paned = XtCreateManagedWidget("paned", panedWidgetClass, toplevel,
				    NULL, (Cardinal) 0);
    menuBar = XtCreateManagedWidget ("menuBar", boxWidgetClass, paned, NULL, 0);

    fileMenuButton = XtCreateManagedWidget ("fileMenuButton", menuButtonWidgetClass,
				    menuBar, NULL, (Cardinal) 0);
    fileMenu = XtCreatePopupShell ("fileMenu", simpleMenuWidgetClass,
				    fileMenuButton, NULL, (Cardinal) 0);
    for (i = 0; i < XtNumber (fileMenuEntries); i++) {
	entry = XtCreateManagedWidget(fileMenuEntries[i].name,
				      smeBSBObjectClass, fileMenu,
				      NULL, (Cardinal) 0);
	XtAddCallback (entry, XtNcallback, fileMenuEntries[i].function, NULL);
    }

    (void) XtCreateManagedWidget ("prevButton", commandWidgetClass,
				  menuBar, NULL, (Cardinal) 0);

    pageNumber = XtCreateManagedWidget("pageNumber", asciiTextWidgetClass,
					menuBar, NULL, (Cardinal) 0);
  
    (void) XtCreateManagedWidget ("nextButton", commandWidgetClass,
				  menuBar, NULL, (Cardinal) 0);

#ifdef NOTDEF
    form = XtCreateManagedWidget ("form", formWidgetClass, paned,
				    NULL, (Cardinal) 0);
    panner = XtCreateManagedWidget ("panner", pannerWidgetClass,
				    form, NULL, 0);
    porthole = XtCreateManagedWidget ("porthole", portholeWidgetClass,
				      form, NULL, 0);
    XtAddCallback(porthole, 
		  XtNreportCallback, PortholeCallback, (XtPointer) panner);
    XtAddCallback(panner, 
		  XtNreportCallback, PannerCallback, (XtPointer) porthole);
#else
    porthole = XtCreateManagedWidget ("viewport", viewportWidgetClass,
				      paned, NULL, 0);
#endif
    dvi = XtCreateManagedWidget ("dvi", dviWidgetClass, porthole, NULL, 0);
    if (file_name)
	VisitFile (file_name, FALSE);
    XtRealizeWidget (toplevel);
    wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW",
				   False);
    (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel),
                            &wm_delete_window, 1);
    XtAppMainLoop(xtcontext);

    return 0;
}
Exemplo n.º 21
0
int main(int argc, char **argv)
{
    char	    *file_name = 0;
    Cardinal	    i;
    static Arg	    labelArgs[] = {
			{XtNlabel, (XtArgVal) pageLabel},
    };
    XtAppContext    xtcontext;
    Arg		    topLevelArgs[2];
    Widget          entry;
    Arg		    pageNumberArgs[1];
    int		    page_number;

    toplevel = XtAppInitialize(&xtcontext, "GXditview",
			    options, XtNumber (options),
 			    &argc, argv, fallback_resources, NULL, 0);
    if (argc > 2
	|| (argc == 2 && (!strcmp(argv[1], "-help")
			  || !strcmp(argv[1], "--help"))))
	Syntax(argv[0]);

    XtGetApplicationResources(toplevel, (XtPointer)&app_resources,
			      resources, XtNumber(resources),
			      NULL, (Cardinal) 0);
    if (app_resources.print_command)
	strcpy(current_print_command, app_resources.print_command);

    XtAppAddActions(xtcontext, xditview_actions, XtNumber (xditview_actions));

    XtSetArg (topLevelArgs[0], XtNiconPixmap,
	      XCreateBitmapFromData (XtDisplay (toplevel),
				     XtScreen(toplevel)->root,
				     (char *)xdit_bits,
				     xdit_width, xdit_height));
				    
    XtSetArg (topLevelArgs[1], XtNiconMask,
	      XCreateBitmapFromData (XtDisplay (toplevel),
				     XtScreen(toplevel)->root,
				     (char *)xdit_mask_bits, 
				     xdit_mask_width, xdit_mask_height));
    XtSetValues (toplevel, topLevelArgs, 2);
    if (argc > 1)
	file_name = argv[1];

    /*
     * create the menu and insert the entries
     */
    simpleMenu = XtCreatePopupShell ("menu", simpleMenuWidgetClass, toplevel,
				    NULL, 0);
    for (i = 0; i < XtNumber (menuEntries); i++) {
	entry = XtCreateManagedWidget(menuEntries[i].name, 
				      smeBSBObjectClass, simpleMenu,
				      NULL, (Cardinal) 0);
	XtAddCallback(entry, XtNcallback, menuEntries[i].function, NULL);
    }

    paned = XtCreateManagedWidget("paned", panedWidgetClass, toplevel,
				    NULL, (Cardinal) 0);
    viewport = XtCreateManagedWidget("viewport", viewportWidgetClass, paned,
				     NULL, (Cardinal) 0);
    dvi = XtCreateManagedWidget ("dvi", dviWidgetClass, viewport, NULL, 0);
    page = XtCreateManagedWidget ("label", labelWidgetClass, paned,
					labelArgs, XtNumber (labelArgs));
    XtSetArg (pageNumberArgs[0], XtNpageNumber, &page_number);
    XtGetValues (dvi, pageNumberArgs, 1);
    if (file_name)
	NewFile (file_name);
    /* NewFile modifies current_file_name, so do this here. */
    if (app_resources.filename)
	strcpy(current_file_name, app_resources.filename);
    XtRealizeWidget (toplevel);
    if (file_name)
	SetPageNumber (page_number);
    XtAppMainLoop(xtcontext);
    return 0;
}
Exemplo n.º 22
0
/*
 * Initialize a term_data
 */
static errr term_data_init(term_data *td, Widget topLevel,
                           int key_buf, String name,
                           ArgList widget_arg, Cardinal widget_arg_no, int i)
{
	Widget parent;
	term *t = &td->t;

	int cols = 80;
	int rows = 24;

	char buf[80];
	cptr str;

	int val;

	/* Create the shell widget */
	parent = XtCreatePopupShell(name, topLevelShellWidgetClass, topLevel,
	                            NULL, 0);

	/* Window specific cols */
	sprintf(buf, "ANGBAND_X11_COLS_%d", i);
	str = getenv(buf);
	val = (str != NULL) ? atoi(str) : -1;
	if (val > 0) cols = val;

	/* Window specific rows */
	sprintf(buf, "ANGBAND_X11_ROWS_%d", i);
	str = getenv(buf);
	val = (str != NULL) ? atoi(str) : -1;
	if (val > 0) rows = val;

	/* Hack the main window must be at least 80x24 */
	if (i == 0)
	{
		if (cols < 80) cols = 80;
		if (rows < 24) rows = 24;
	}

	/* Reset the initial size */
	widget_arg[0].value = rows;
	widget_arg[1].value = cols;

	/* Hack  ox==oy in xaw port */

	/* Window specific inner border offset (ox) */
	sprintf(buf, "ANGBAND_X11_IBOX_%d", i);
	str = getenv(buf);
	val = (str != NULL) ? atoi(str) : -1;
	if (val > 0) widget_arg[6].value = val;

	/* Window specific inner border offset (oy) */
	sprintf(buf, "ANGBAND_X11_IBOY_%d", i);
	str = getenv(buf);
	val = (str != NULL) ? atoi(str) : -1;
	if (val > 0) widget_arg[6].value = val;

	/* Create the interior widget */
	td->widget = (AngbandWidget)
	XtCreateManagedWidget(name, angbandWidgetClass,
	                      parent, widget_arg, widget_arg_no);

	/* Initialize the term (full size) */
	term_init(t, cols, rows, key_buf);

	/* Use a "soft" cursor */
	t->soft_cursor = TRUE;

	/* Erase with "white space" */
	t->attr_blank = TERM_WHITE;
	t->char_blank = ' ';

	/* Hooks */
	t->xtra_hook = Term_xtra_xaw;
	t->curs_hook = Term_curs_xaw;
	t->wipe_hook = Term_wipe_xaw;
	t->text_hook = Term_text_xaw;

	/* Save the data */
	t->data = td;

	/* Register the keypress event handler */
	XtAddEventHandler((Widget)td->widget, KeyPressMask,
	                  False, (XtEventHandler) handle_event, td);

	/* Redraw callback */
	XtAddCallback((Widget)td->widget, XtNredrawCallback,
	              react_redraw, td);

	/* Realize the widget */
	XtRealizeWidget(parent);

	/* Have we redefined the font? */
	if (streq(td->widget->angband.font, DEFAULT_X11_FONT))
	{
		XFontStruct *fnt;

		/* Check if the font exists */
		fnt = getFont(td->widget, (String) get_default_font(i), FALSE);

		/* The font didn't exist */
		if (fnt == NULL)
		{
			XtWarning("Couldn't find the requested font!");
		}
		else
		{
			int height, width;

			/* Free the old font */
			XFreeFont(XtDisplay((Widget)td->widget), td->widget->angband.fnt);

			/* Update font information */
			td->widget->angband.fontheight = fnt->ascent + fnt->descent;
			td->widget->angband.fontwidth = fnt->max_bounds.width;
			td->widget->angband.fontascent = fnt->ascent;

			for (i = 0; i < NUM_COLORS; i++)
			{
				/* Be sure the correct font is ready */
				XSetFont(XtDisplay((Widget)td->widget),
					 td->widget->angband.gc[i], fnt->fid);
			}

			/* Get the window shape */
			height = (td->widget->angband.start_rows *
				td->widget->angband.fontheight +
				2 * td->widget->angband.internal_border);
			width = (td->widget->angband.start_columns *
				td->widget->angband.fontwidth +
				2 * td->widget->angband.internal_border);

			/* Request a change to the new shape */
			if (XtMakeResizeRequest((Widget)td->widget,
				 width, height, NULL, NULL) == XtGeometryNo)
			{
				/* Not allowed */
				XtWarning("Size change denied!");
			}
			else
			{
				/* Recalculate size hints */
				calculateSizeHints(td->widget);
			}
		}
	}

	/* Make it visible */
	XtPopup(parent, XtGrabNone);

	/* Activate (important) */
	Term_activate(t);


	Resize_term(td->widget);

	return 0;
}
Exemplo n.º 23
0
/*
 * Initialize a term_data
 */
static errr term_data_init(term_data *td, Widget topLevel,
                           int key_buf, String name,
                           ArgList widget_arg, Cardinal widget_arg_no, int i)
{
	Widget parent;
	term *t = &td->t;

	int cols = 80;
	int rows = 24;

	char buf[80];
	cptr str;

	int val;

	/* Create the shell widget */
	parent = XtCreatePopupShell(name, topLevelShellWidgetClass, topLevel,
	                            NULL, 0);

	/* Window specific cols */
	sprintf(buf, "ANGBAND_X11_COLS_%d", i);
	str = getenv(buf);
	val = (str != NULL) ? atoi(str) : -1;
	if (val > 0) cols = val;

	/* Window specific rows */
	sprintf(buf, "ANGBAND_X11_ROWS_%d", i);
	str = getenv(buf);
	val = (str != NULL) ? atoi(str) : -1;
	if (val > 0) rows = val;

	/* Hack the main window must be at least 80x24 */
	if (i == 0)
	{
		if (cols < 80) cols = 80;
		if (rows < 24) rows = 24;
	}

	/* Reset the initial size */
	widget_arg[0].value = rows;
	widget_arg[1].value = cols;

	/* Create the interior widget */
	td->widget = (AngbandWidget)
	XtCreateManagedWidget(name, angbandWidgetClass,
	                      parent, widget_arg, widget_arg_no);

	/* Initialize the term (full size) */
	term_init(t, cols, rows, key_buf);

	/* Use a "soft" cursor */
	t->soft_cursor = TRUE;

	/* Erase with "white space" */
	t->attr_blank = TERM_WHITE;
	t->char_blank = ' ';

	/* Hooks */
	t->xtra_hook = Term_xtra_xaw;
	t->curs_hook = Term_curs_xaw;
	t->wipe_hook = Term_wipe_xaw;
	t->text_hook = Term_text_xaw;

	/* Save the data */
	t->data = td;

	/* Register the keypress event handler */
	XtAddEventHandler((Widget)td->widget, KeyPressMask,
	                  False, (XtEventHandler) handle_event, td);

	/* Redraw callback */
	XtAddCallback((Widget)td->widget, XtNredrawCallback,
	              react_redraw, td);

	/* Realize the widget */
	XtRealizeWidget(parent);

	/* Make it visible */
	XtPopup(parent, XtGrabNone);

	/* Activate (important) */
	Term_activate(t);

	Resize_term(td->widget);

	return 0;
}
Exemplo n.º 24
0
void
CreateControlPanel()
{
	Widget	PopupShell, Form1, SBResLabel, SBStringResLabel,
                SBNumericResLabel;
	Widget  Manager1, Manager2, Manager3;
	Widget  ArrowSensLabel, ArrowSensPulldown, ArrowSensOptions,
	        ArrowSensPB[NUM_ARROW_SENS_BTNS];
	Widget  DecimalPtsLabel, DecimalPtsTF;
	Widget  IncrValueLabel, IncrValueTF;
	Widget  MaxValueLabel, MaxValueTF;
	Widget  MinValueLabel, MinValueTF;
	Widget  NumValuesLabel, NumValuesTF;
	Widget  PositionLabel, PositionTF;
	Widget  ChildTypeLabel, ChildTypePulldown, ChildTypeOptions,
                ChildTypePB[NUM_CHILD_TYPE_BTNS];
	Widget  ValuesLabel, ValuesComboBox;
	XmString	string;
	int	i;

        n = 0;
        XtSetArg( args[n], XmNx, 0 ); n++;
        XtSetArg( args[n], XmNy, 500 ); n++;
        XtSetArg( args[n], XmNwidth,  CONTROL_PANEL_WIDTH ); n++;
        XtSetArg( args[n], XmNheight,  CONTROL_PANEL_HEIGHT ); n++;
        PopupShell = XtCreatePopupShell("Resource Control Panel",
                                         topLevelShellWidgetClass,
                                         Shell1, args, n );
        XtManageChild( PopupShell );

        n = 0;
	Form1 = XmCreateForm( PopupShell, "Form1", args, n );
        XtManageChild( Form1 );



        string = XmStringCreateLtoR("SpinBox Resources",
				XmFONTLIST_DEFAULT_TAG );

        n = 0;
        XtSetArg( args[n], XmNtopAttachment, XmATTACH_FORM ); n++;
        XtSetArg( args[n], XmNleftAttachment, XmATTACH_FORM ); n++;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        XtSetArg( args[n], XmNbackground, CommonGetColor("white")); n++;
        XtSetArg( args[n], XmNforeground, CommonGetColor("blue")); n++;
        SBResLabel = XmCreateLabel( Form1, "SBResLabel", args, n );
        XtManageChild( SBResLabel );

        XmStringFree( string );

        Manager1 = 
        CreateSpinBoxResourceControls( Form1, SBResLabel, Form1, Form1 );

      /*
       *  Create SpinBox Constraint Resource Panel for an XmSTRING child
       *  type.
       */
        Manager2 = CreateConstraintResourceControls( Form1, Form1, Form1, 
                          XmSTRING );

        string = XmStringCreateLtoR("SpinBox Constraint Resources - XmSTRING",
                     XmFONTLIST_DEFAULT_TAG );
        n = 0; 
        XtSetArg( args[n], XmNtopAttachment, XmATTACH_WIDGET ); n++;
        XtSetArg( args[n], XmNtopWidget, Manager1 ); n++;
        XtSetArg( args[n], XmNleftAttachment, XmATTACH_FORM ); n++;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        XtSetArg( args[n], XmNbackground, CommonGetColor("white")); n++;
        XtSetArg( args[n], XmNforeground, CommonGetColor("blue")); n++;
        SBStringResLabel = XmCreateLabel( Form1, "SBStringResLabel",
                                          args, n );
        XtManageChild( SBStringResLabel );

        XmStringFree( string );

      /*
       *  Create SpinBox Constraint Resource Panel for an XmNUMERIC child
       *  type.
       */
        Manager3 = CreateConstraintResourceControls( Form1, Manager2,
                          Form1, XmNUMERIC );

        string = XmStringCreateLtoR("SpinBox Constraint Resources - XmNUMERIC",
                                XmFONTLIST_DEFAULT_TAG );

        n = 0;
        XtSetArg( args[n], XmNtopAttachment, XmATTACH_WIDGET ); n++;
        XtSetArg( args[n], XmNtopWidget, Manager1 ); n++;
        XtSetArg( args[n], XmNx, CONTROL_PANEL_WIDTH / 2 - MARGIN ); n++;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        XtSetArg( args[n], XmNbackground, CommonGetColor("white")); n++;
        XtSetArg( args[n], XmNforeground, CommonGetColor("blue")); n++;
        SBNumericResLabel = XmCreateLabel( Form1, "SBStringResLabel",
                                          args, n );
        XtManageChild( SBNumericResLabel );

        XmStringFree( string );

   XtPopup( PopupShell, XtGrabNone );

}
Exemplo n.º 25
0
WGeMotif::WGeMotif( Widget wge_parent_wid, void *wge_parent_ctx, char *wge_name, char *wge_filename,
	  int wge_scrollbar, int wge_menu, int wge_navigator, int wge_width, int wge_height, 
	  int x, int y, char *object_name, int wge_modal = 0) :
  WGe(wge_parent_ctx, wge_name, wge_filename, wge_scrollbar, wge_menu, wge_navigator, wge_width,
      wge_height, x, y, object_name, wge_modal),
  parent_wid(wge_parent_wid), value_dialog(0), set_focus_disabled(0), focus_timerid(0)
{
  pwr_tFileName	uid_filename = {"$pwr_exe/wb_wge.uid"};
  char		*uid_filename_p = uid_filename;
  Arg 		args[20];
  pwr_tStatus	sts;
  char 		title[300];
  int		i;
  MrmHierarchy s_DRMh;
  MrmType dclass;
  Widget	wge_widget;
  char		wname[] = "Proview/R Ge";

  static char translations[] =
    "<ConfigureNotify>: resize()\n\
<FocusIn>: wge_inputfocus()";
  static XtTranslations compiled_translations = NULL;

  static XtActionsRec actions[] =
  {
    {(char*) "wge_inputfocus",      (XtActionProc) action_inputfocus},
    {(char*) "resize",      (XtActionProc) action_resize},
  };

  static MrmRegisterArg	reglist[] = {
        {(char*) "wge_ctx", 0 },
	{(char*) "wge_activate_exit",(caddr_t)activate_exit },
	{(char*) "wge_activate_zoom_in",(caddr_t)activate_zoom_in },
	{(char*) "wge_activate_zoom_out",(caddr_t)activate_zoom_out },
	{(char*) "wge_activate_zoom_reset",(caddr_t)activate_zoom_reset },
	{(char*) "wge_activate_help",(caddr_t)activate_help },
	{(char*) "wge_create_graph_form",(caddr_t)create_graph_form },
	{(char*) "wge_create_menu",(caddr_t)create_menu },
	{(char*) "wge_create_value_input",(caddr_t)create_value_input },
	{(char*) "wge_activate_value_input",(caddr_t)activate_value_input },
	{(char*) "wge_activate_confirm_ok",(caddr_t)activate_confirm_ok },
	{(char*) "wge_activate_confirm_cancel",(caddr_t)activate_confirm_cancel },
	{(char*) "wge_create_message_dia",(caddr_t)create_message_dia }
	};

  static int	reglist_num = (sizeof reglist / sizeof reglist[0]);

  dcli_translate_filename( uid_filename, uid_filename);

  // Create object context
  strcpy( filename, wge_filename);
  strcpy( name, wge_name);
  // command_cb = command_cb;
  // help_cb = help_cb;
  // close_cb = close_cb;
  // is_authorized_cb = is_authorized_cb;

  // Motif
  MrmInitialize();

  cdh_StrncpyCutOff( title, name, sizeof(title), 1);

  reglist[0].value = (caddr_t) this;


  sts = MrmOpenHierarchy( 1, &uid_filename_p, NULL, &s_DRMh);
  if (sts != MrmSUCCESS) printf("can't open %s\n", uid_filename);

  // Save the context structure in the widget
  i = 0;
  XtSetArg(args[i], XmNuserData, (XtPointer) this);i++;
  XtSetArg(args[i],XmNdeleteResponse, XmDO_NOTHING);i++;

  toplevel = XtCreatePopupShell( title, 
		topLevelShellWidgetClass, parent_wid, args, i);

  MrmRegisterNames(reglist, reglist_num);

  sts = MrmFetchWidgetOverride( s_DRMh, (char*) "wge_window", toplevel,
			wname, args, 1, &wge_widget, &dclass);
  if (sts != MrmSUCCESS)  printf("can't fetch %s\n", wname);

  sts = MrmFetchWidget(s_DRMh, (char*) "input_dialog", toplevel,
		&value_dialog, &dclass);
  if (sts != MrmSUCCESS)  printf("can't fetch input dialog\n");

  sts = MrmFetchWidget(s_DRMh, (char*) "confirm_dialog", toplevel,
		&confirm_widget, &dclass);
  if (sts != MrmSUCCESS)  printf("can't fetch confirm dialog\n");

  sts = MrmFetchWidget(s_DRMh, (char*) "message_dialog", toplevel,
		&message_dia_widget, &dclass);
  if (sts != MrmSUCCESS)  printf("can't fetch message dialog\n");

  MrmCloseHierarchy(s_DRMh);

  if (compiled_translations == NULL) 
    XtAppAddActions( XtWidgetToApplicationContext(toplevel), 
						actions, XtNumber(actions));
 
  if (compiled_translations == NULL) 
    compiled_translations = XtParseTranslationTable(translations);
  XtOverrideTranslations( wge_widget, compiled_translations);

  i = 0;
  if ( width == 0 || height == 0)
  {
    XtSetArg(args[i],XmNwidth,600);i++;
    XtSetArg(args[i],XmNheight,500);i++;
  }
  else
  {
    XtSetArg(args[i],XmNwidth,width);i++;
    XtSetArg(args[i],XmNheight,height);i++;
    XtSetArg(args[i], XmNminAspectX, width); i++;
    XtSetArg(args[i], XmNminAspectY, height); i++;
    XtSetArg(args[i], XmNmaxAspectX, width); i++;
    XtSetArg(args[i], XmNmaxAspectY, height); i++;
  }
  if ( !(x == 0 && y == 0))
  {
    XtSetArg(args[i],XmNx, x);i++;
    XtSetArg(args[i],XmNy, y);i++;
  }
  XtSetValues( toplevel, args,i);
    
  XtManageChild( wge_widget);

  if ( !menu)
    XtUnmanageChild( menu_widget);

  graph = new GraphMotif( this, graph_form, "Plant", 
		&grow_widget, &sts, "pwrp_exe:", graph_eMode_Runtime, 
		scrollbar, 1, object_name, 0, 0);
  ((Graph *)graph)->message_cb = &message;
  ((Graph *)graph)->close_cb = &graph_close_cb;
  ((Graph *)graph)->init_cb = &graph_init_cb;
  ((Graph *)graph)->change_value_cb = &change_value_cb;
  ((Graph *)graph)->confirm_cb = &confirm_cb;
  ((Graph *)graph)->message_dialog_cb = &message_dialog_cb;
  ((Graph *)graph)->command_cb = &wge_command_cb;
  ((Graph *)graph)->is_authorized_cb = &wge_is_authorized_cb;
 
  XtPopup( toplevel, XtGrabNone);

  if ( navigator)
  {
    // Create navigator popup

    i = 0;
    XtSetArg(args[i],XmNallowShellResize, TRUE); i++;
    XtSetArg(args[i],XmNallowResize, TRUE); i++;
    XtSetArg(args[i],XmNwidth,200);i++;
    XtSetArg(args[i],XmNheight,200);i++;
    XtSetArg(args[i],XmNx,500);i++;
    XtSetArg(args[i],XmNy,500);i++;
    XtSetArg(args[i],XmNdeleteResponse, XmDO_NOTHING);i++;

    nav_shell = XmCreateDialogShell( grow_widget, (char*) "Navigator",
        args, i);
    XtManageChild( nav_shell);

    ((GraphMotif *)graph)->create_navigator( nav_shell);
//    XtManageChild( nav_widget);
    XtRealizeWidget( nav_shell);
    ((Graph *)graph)->set_nav_background_color();
  }

  // Connect the window manager close-button to exit
  flow_AddCloseVMProtocolCb( toplevel, 
	(XtCallbackProc)activate_exit, this);

}
Exemplo n.º 26
0
/****************************************************************
...
*****************************************************************/
struct Diplomacy_dialog *create_diplomacy_dialog(struct player *plr0, 
						 struct player *plr1)
{
  char buf[512], *pheadlinem;
  struct Diplomacy_dialog *pdialog;
  Dimension width, height, maxwidth;
  Widget popupmenu;
  XtTranslations textfieldtranslations;
  
  pdialog=(struct Diplomacy_dialog *)malloc(sizeof(struct Diplomacy_dialog));
  genlist_insert(&diplomacy_dialogs, pdialog, 0);
  
  init_treaty(&pdialog->treaty, plr0, plr1);
  
  pdialog->dip_dialog_shell = XtCreatePopupShell("dippopupshell", 
						 topLevelShellWidgetClass,
						 toplevel, NULL, 0);

  pdialog->dip_form = XtVaCreateManagedWidget("dipform", 
					      formWidgetClass, 
					      pdialog->dip_dialog_shell,
					      NULL);

  pdialog->dip_main_form = XtVaCreateManagedWidget("dipmainform", 
						   formWidgetClass, 
						   pdialog->dip_form,
						   NULL);
  
  pdialog->dip_form0 = XtVaCreateManagedWidget("dipform0", 
					       formWidgetClass, 
					       pdialog->dip_main_form, 
					       NULL);
  
  pdialog->dip_formm = XtVaCreateManagedWidget("dipformm", 
					       formWidgetClass, 
					       pdialog->dip_main_form, 
					       NULL);

  pdialog->dip_form1 = XtVaCreateManagedWidget("dipform1", 
					       formWidgetClass, 
					       pdialog->dip_main_form, 
					       NULL);
  
  sprintf(buf, "The %s offerings", get_race_name(plr0->race));
  pdialog->dip_headline0=XtVaCreateManagedWidget("dipheadline0", 
						 labelWidgetClass, 
						 pdialog->dip_form0, 
						 XtNlabel, buf,
						 NULL);   

  sprintf(buf, "The %s offerings", get_race_name(plr1->race));
  pdialog->dip_headline1=XtVaCreateManagedWidget("dipheadline1", 
						 labelWidgetClass, 
						 pdialog->dip_form1, 
						 XtNlabel, buf,
						 NULL);   

  
  pdialog->dip_map_command0=XtVaCreateManagedWidget("dipmapcommand0", 
						    commandWidgetClass, 
						    pdialog->dip_form0, 
						    NULL);

  pdialog->dip_map_command1=XtVaCreateManagedWidget("dipmapcommand1",
						    commandWidgetClass, 
						    pdialog->dip_form1, 
						    NULL);

  pdialog->dip_tech_menubutton0=XtVaCreateManagedWidget("diptechmenubutton0", 
							menuButtonWidgetClass,
							pdialog->dip_form0,
							NULL);
  popupmenu=XtVaCreatePopupShell("menu", 
				 simpleMenuWidgetClass, 
				 pdialog->dip_tech_menubutton0, 
				 NULL);
  if(!fill_diplomacy_tech_menu(popupmenu, plr0, plr1))
    XtSetSensitive(pdialog->dip_tech_menubutton0, FALSE);
  
  
  pdialog->dip_tech_menubutton1=XtVaCreateManagedWidget("diptechmenubutton1", 
							menuButtonWidgetClass,
							pdialog->dip_form1,
							NULL);
  popupmenu=XtVaCreatePopupShell("menu", 
				 simpleMenuWidgetClass, 
				 pdialog->dip_tech_menubutton1, 
				 NULL);
  if(!fill_diplomacy_tech_menu(popupmenu, plr1, plr0))
    XtSetSensitive(pdialog->dip_tech_menubutton1, FALSE);
  
  pdialog->dip_gold_input0=XtVaCreateManagedWidget("dipgoldinput0", 
						   asciiTextWidgetClass,
						   pdialog->dip_form0,
						   NULL);

  pdialog->dip_gold_input1=XtVaCreateManagedWidget("dipgoldinput1", 
						   asciiTextWidgetClass,
						   pdialog->dip_form1,
						   NULL);
  
  sprintf(buf, "Gold(max %d)", plr0->economic.gold);
  pdialog->dip_gold_label0=XtVaCreateManagedWidget("dipgoldlabel0", 
						   labelWidgetClass,
						   pdialog->dip_form0,
						   XtNlabel, buf,
						   NULL);

  sprintf(buf, "Gold(max %d)", plr1->economic.gold);
  pdialog->dip_gold_label1=XtVaCreateManagedWidget("dipgoldlabel1", 
						   labelWidgetClass,
						   pdialog->dip_form1,
						   XtNlabel, buf,
						   NULL);

  
  sprintf(buf, "This Eternal Treaty\nmarks the results of the diplomatic work between\nThe %s %s %s\nand\nThe %s %s %s",
	  get_race_name(plr0->race),
	  get_ruler_title(plr0->goverment),
	  plr0->name,
	  get_race_name(plr1->race),
	  get_ruler_title(plr1->goverment),
	  plr1->name);
  
  pheadlinem=create_centered_string(buf);
  pdialog->dip_headline1=XtVaCreateManagedWidget("dipheadlinem", 
						 labelWidgetClass, 
						 pdialog->dip_formm,
						 XtNlabel, pheadlinem,
						 NULL);
  
  pdialog->dip_clauselabel=XtVaCreateManagedWidget("dipclauselabel",
						   labelWidgetClass, 
						   pdialog->dip_formm, 
						   NULL);   
  
  pdialog->dip_view =  XtVaCreateManagedWidget("dipview",
					       viewportWidgetClass, 
					       pdialog->dip_formm, 
					       NULL);
  
  
  pdialog->dip_clauselist = XtVaCreateManagedWidget("dipclauselist",
						    listWidgetClass, 
						    pdialog->dip_view, 
						    XtNlist, 
						    (XtArgVal)dummy_clause_list_strings,
						    NULL);

  XtVaGetValues(pdialog->dip_headline1, XtNwidth, &width, NULL);
  XtVaSetValues(pdialog->dip_clauselist, XtNwidth, width, NULL); 

  sprintf(buf, "%s view:", get_race_name(plr0->race));
  pdialog->dip_acceptlabel0=XtVaCreateManagedWidget("dipacceptlabel0",
						    labelWidgetClass, 
						    pdialog->dip_formm, 
						    XtNlabel, buf,
						    NULL);
  pdialog->dip_acceptthumb0=XtVaCreateManagedWidget("dipacceptthumb0",
						    labelWidgetClass, 
						    pdialog->dip_formm, 
						    XtNbitmap, get_thumb_pixmap(0),
						    NULL);
  sprintf(buf, "%s view:", get_race_name(plr1->race));
  pdialog->dip_acceptlabel1=XtVaCreateManagedWidget("dipacceptlabel1",
						    labelWidgetClass, 
						    pdialog->dip_formm, 
						    XtNlabel, buf,
						    NULL);
  pdialog->dip_acceptthumb1=XtVaCreateManagedWidget("dipacceptthumb1",
						    labelWidgetClass, 
						    pdialog->dip_formm, 
						    NULL);

  
  pdialog->dip_erase_clause_command=XtVaCreateManagedWidget("diperaseclausecommand", 
							     commandWidgetClass, 
							     pdialog->dip_main_form, 
							     NULL);
  
  pdialog->dip_accept_command = XtVaCreateManagedWidget("dipacceptcommand", 
							commandWidgetClass, 
							pdialog->dip_form,
							NULL);


  pdialog->dip_close_command = XtVaCreateManagedWidget("dipclosecommand", 
						       commandWidgetClass,
						       pdialog->dip_form,
						       NULL);

  XtAddCallback(pdialog->dip_close_command, XtNcallback, 
		diplomacy_dialog_close_callback, (XtPointer)pdialog);
  XtAddCallback(pdialog->dip_map_command0, XtNcallback, 
		diplomacy_dialog_map_callback, (XtPointer)pdialog);
  XtAddCallback(pdialog->dip_map_command1, XtNcallback, 
		diplomacy_dialog_map_callback, (XtPointer)pdialog);
  XtAddCallback(pdialog->dip_erase_clause_command, XtNcallback, 
		diplomacy_dialog_erase_clause_callback, (XtPointer)pdialog);
  XtAddCallback(pdialog->dip_accept_command, XtNcallback, 
		diplomacy_dialog_accept_callback, (XtPointer)pdialog);
  

  textfieldtranslations = 
  XtParseTranslationTable("<Key>Return: diplo-dialog-returnkey()");
  XtOverrideTranslations(pdialog->dip_gold_input0, textfieldtranslations);
  XtOverrideTranslations(pdialog->dip_gold_input1, textfieldtranslations);
  
  XtRealizeWidget(pdialog->dip_dialog_shell);
  

  XtVaGetValues(pdialog->dip_map_command0, XtNwidth, &maxwidth, NULL);
/*  printf("%d\n", maxwidth);*/
  XtVaGetValues(pdialog->dip_tech_menubutton0, XtNwidth, &width, NULL);
/*  printf("%d\n", width);*/
  maxwidth=MAX(width, maxwidth);
  XtVaGetValues(pdialog->dip_gold_input0, XtNwidth, &width, NULL);
/*  printf("%d\n", width);*/
  maxwidth=MAX(width, maxwidth);
  XtVaSetValues(pdialog->dip_map_command0, XtNwidth, maxwidth, NULL);
  XtVaSetValues(pdialog->dip_tech_menubutton0, XtNwidth, maxwidth, NULL);
  XtVaSetValues(pdialog->dip_gold_input0,  XtNwidth, maxwidth, NULL);
  
  XtVaGetValues(pdialog->dip_formm, XtNheight, &height, NULL);
  XtVaSetValues(pdialog->dip_form0, XtNheight, height, NULL); 
  XtVaSetValues(pdialog->dip_form1, XtNheight, height, NULL); 
  
  
  
  free(pheadlinem);

  update_diplomacy_dialog(pdialog);
  
  return pdialog;
}
Exemplo n.º 27
0
void
MakeTopBox()
{
  Widget form, command, label; /* widgets. */
  Arg arglist[TOPARGS];		/* An argument list */
  Cardinal num_args = 0;	/* The number of arguments. */
  ManpageGlobals * man_globals;
  static char * full_size[] = {
    "topLabel", MANPAGE_BUTTON, NULL
  };
  static char * half_size[] = {
    HELP_BUTTON, QUIT_BUTTON, NULL
  };
  
/* create the top icon. */

  num_args = 0;
  XtSetArg(arglist[num_args], XtNiconPixmap,
	   XCreateBitmapFromData( XtDisplay(initial_widget), 
				 XtScreen(initial_widget)->root,
				 (char *)iconclosed_bits, iconclosed_width,
				 iconclosed_height));
  num_args++;
  XtSetArg(arglist[num_args], XtNtitle, resources.title);
  num_args++;
  XtSetArg(arglist[num_args], XtNiconic, resources.iconic);
  num_args++;
  top = XtCreatePopupShell(TOPBOXNAME, topLevelShellWidgetClass, 
			   initial_widget, arglist, num_args);

  form = XtCreateManagedWidget("form", formWidgetClass, top, 
			       NULL, (Cardinal) 0);

  label = XtCreateManagedWidget("topLabel", labelWidgetClass, form, 
			       NULL, (Cardinal) 0);

  num_args = 0;
  XtSetArg(arglist[num_args], XtNfromVert, label); num_args++;
  command = XtCreateManagedWidget(HELP_BUTTON, commandWidgetClass, form, 
				  arglist, num_args);

  /* use same vertical as help widget. */
  XtSetArg(arglist[num_args], XtNfromHoriz, command); num_args++;
  command = XtCreateManagedWidget(QUIT_BUTTON, commandWidgetClass, form, 
				  arglist, num_args);

  num_args = 0;
  XtSetArg(arglist[num_args], XtNfromVert, command); num_args++;
  command = XtCreateManagedWidget(MANPAGE_BUTTON, commandWidgetClass, form, 
				  arglist, num_args);

  help_widget = NULL;		/* We have not seen the help yet. */

  FormUpWidgets(form, full_size, half_size);

  XtRealizeWidget(top);
				/* add WM_COMMAND property */
  XSetCommand(XtDisplay(top), XtWindow(top), saved_argv, saved_argc);

  man_globals = (ManpageGlobals*) XtMalloc( (Cardinal) sizeof(ManpageGlobals));
  man_globals->label = NULL;
  man_globals->manpagewidgets.directory = NULL;
  man_globals->manpagewidgets.manpage = NULL;
  man_globals->manpagewidgets.box = NULL;
  man_globals->current_directory = 0;
  MakeSearchWidget(man_globals, top);
  MakeSaveWidgets(man_globals, top);

  SaveGlobals( (man_globals->This_Manpage = top), man_globals);
  XtMapWidget(top);
  AddCursor(top, resources.cursors.top);

/*
 * Set up ICCCM delete window.
 */
  wm_delete_window = XInternAtom(XtDisplay(top), "WM_DELETE_WINDOW",
				 False);
  XtOverrideTranslations
      (top, XtParseTranslationTable ("<Message>WM_PROTOCOLS: Quit()"));
  (void) XSetWMProtocols (XtDisplay(top), XtWindow(top),
			  &wm_delete_window, 1);
  

}
Exemplo n.º 28
0
RtTraceMotif::RtTraceMotif( void *tr_parent_ctx, Widget tr_parent_wid, pwr_tObjid tr_objid,
			    pwr_tStatus *status) :
  RtTrace( tr_parent_ctx, tr_objid, status), parent_wid(tr_parent_wid)
{
  // FlowWidget	fwidget;
  char		uid_filename[120] = {"xtt_trace.uid"};
  char		*uid_filename_p = uid_filename;
  Arg 		args[20];
  unsigned long sts;
  pwr_tOName   	name;
  int		i;
  pwr_tObjid	window_objid;
  pwr_tClassId	cid;
  char   	title[220];
  pwr_tOName   	hostname;
  pwr_tOName   	plcconnect;
  MrmHierarchy s_DRMh;
  MrmType dclass;
  Widget	trace_widget;
  static MrmRegisterArg	reglist[] = {
        {(char*) "tra_ctx", 0 },
	{(char*) "tra_activate_close",(caddr_t)activate_close },
	{(char*) "tra_activate_print",(caddr_t)activate_print },
	{(char*) "tra_activate_printselect",(caddr_t)activate_printselect },
	{(char*) "tra_activate_savetrace",(caddr_t)activate_savetrace },
	{(char*) "tra_activate_restoretrace",(caddr_t)activate_restoretrace },
	{(char*) "tra_activate_cleartrace",(caddr_t)activate_cleartrace },
	{(char*) "tra_activate_trace",(caddr_t)activate_trace },
	{(char*) "tra_activate_display_object",(caddr_t)activate_display_object },
	{(char*) "tra_activate_open_object",(caddr_t)activate_open_object },
	{(char*) "tra_activate_show_cross",(caddr_t)activate_show_cross },
	{(char*) "tra_activate_open_classgraph",(caddr_t)activate_open_classgraph },
	{(char*) "tra_activate_collect_insert",(caddr_t)activate_collect_insert },
	{(char*) "tra_activate_view",(caddr_t)activate_view },
	{(char*) "tra_activate_simulate",(caddr_t)activate_simulate },
	{(char*) "tra_activate_zoomin",(caddr_t)activate_zoomin },
	{(char*) "tra_activate_zoomout",(caddr_t)activate_zoomout },
	{(char*) "tra_activate_zoomreset",(caddr_t)activate_zoomreset },
	{(char*) "tra_activate_scantime1",(caddr_t)activate_scantime1 },
	{(char*) "tra_activate_scantime2",(caddr_t)activate_scantime2 },
	{(char*) "tra_activate_scantime3",(caddr_t)activate_scantime3 },
	{(char*) "tra_activate_scantime4",(caddr_t)activate_scantime4 },
	{(char*) "tra_activate_scantime5",(caddr_t)activate_scantime5 },
	{(char*) "tra_activate_help",(caddr_t)activate_help },
	{(char*) "tra_activate_helpplc",(caddr_t)activate_helpplc },
	{(char*) "tra_create_form",(caddr_t)create_form },
	{(char*) "tra_create_menu",(caddr_t)create_menu }
	};

  static int	reglist_num = (sizeof reglist / sizeof reglist[0]);

  lng_get_uid( uid_filename, uid_filename);

  sts = gdh_ObjidToName( tr_objid, name, sizeof(name), cdh_mNName); 
  if (EVEN(sts)) {
    *status = sts;
    return;
  }
  strcpy( title, "Trace ");
  strcat( title, name);

  /* Find plcwindow */
  sts = gdh_GetObjectClass( tr_objid, &cid);
  if ( EVEN(sts)) {
    *status = sts;
    return;
  }

  if ( !(cid == pwr_cClass_windowplc ||
         cid == pwr_cClass_windowcond ||
         cid == pwr_cClass_windoworderact ||
         cid == pwr_cClass_windowsubstep ))
  {

    sts = gdh_GetChild( tr_objid, &window_objid);
    if ( EVEN(sts)) {
      *status = sts;
      return;
    }
  }
  else
    window_objid = tr_objid; 

  sts = gdh_GetObjectClass( window_objid, &cid);
  if ( EVEN(sts)) {
    *status = sts;
    return;
  }

  if ( !(cid == pwr_cClass_windowplc ||
         cid == pwr_cClass_windowcond ||
         cid == pwr_cClass_windoworderact ||
         cid == pwr_cClass_windowsubstep )) {
    *status = 0;
    return;
  }

  sts = get_filename( window_objid, filename, &m_has_host, hostname, 
		      plcconnect);
  if ( EVEN(sts)) {
    *status = sts;
    return;
  }

  /* Create object context */
  objid = window_objid;
  if ( m_has_host) {
    strcpy( m_hostname, hostname);
    strcpy( m_plcconnect, plcconnect);
  }
  reglist[0].value = (caddr_t) this;
 
  toplevel = XtCreatePopupShell( name, 
		topLevelShellWidgetClass, parent_wid, args, 0);

  /* Save the context structure in the widget */
  XtSetArg (args[0], XmNuserData, (XtPointer) this);

  sts = MrmOpenHierarchy( 1, &uid_filename_p, NULL, &s_DRMh);
  if (sts != MrmSUCCESS) printf("can't open %s\n", uid_filename);

  MrmRegisterNames(reglist, reglist_num);

  sts = MrmFetchWidgetOverride( s_DRMh, (char*) "trace_window", toplevel,
			title, args, 1, &trace_widget, &dclass);
  if (sts != MrmSUCCESS)  printf("can't fetch %s\n", name);

  MrmCloseHierarchy(s_DRMh);


  i = 0;
  XtSetArg(args[i],XmNwidth,800);i++;
  XtSetArg(args[i],XmNheight,600);i++;
  XtSetValues( toplevel ,args,i);
    
  XtManageChild( trace_widget);

  i = 0;
/*
  XtSetArg(args[i],XmNwidth,790);i++;
  XtSetArg(args[i],XmNheight,560);i++;
*/
  XtSetArg( args[i], XmNtopAttachment, XmATTACH_WIDGET);i++;
  XtSetArg( args[i], XmNtopWidget, menu);i++;
  XtSetArg( args[i], XmNrightAttachment, XmATTACH_FORM);i++;
  XtSetArg( args[i], XmNleftAttachment, XmATTACH_FORM);i++;
  XtSetArg( args[i], XmNbottomAttachment, XmATTACH_FORM);i++;
  flow_widget = FlowCreate( form, (char*) "Flow window", args, i, 
			    init_flow, (void *)this);

  XtManageChild( (Widget) flow_widget);
/*
  XtRealizeWidget(toplevel);
*/
  XtPopup( toplevel, XtGrabNone);

  // fwidget = (FlowWidget) flow_widget;
  // flow_ctx = (flow_tCtx)fwidget->flow.flow_ctx;
  // flow_SetCtxUserData( flow_ctx, this);

  /* Create navigator popup */

  i = 0;
  XtSetArg(args[i],XmNallowShellResize, TRUE); i++;
  XtSetArg(args[i],XmNallowResize, TRUE); i++;
  XtSetArg(args[i],XmNwidth,200);i++;
  XtSetArg(args[i],XmNheight,200);i++;
  XtSetArg(args[i],XmNx,500);i++;
  XtSetArg(args[i],XmNy,500);i++;

  nav_shell = XmCreateDialogShell( flow_widget, (char*) "Navigator",
        args, i);
  XtManageChild( nav_shell);

  i = 0;
  XtSetArg(args[i],XmNwidth,200);i++;
  XtSetArg(args[i],XmNheight,200);i++;
  nav_widget = FlowCreateNav( nav_shell, (char*) "navigator",
        args, i, flow_widget);
  XtManageChild( nav_widget);
  XtRealizeWidget( nav_shell);

  // Connect the window manager close-button to exit
  flow_AddCloseVMProtocolCb( toplevel, 
	(XtCallbackProc)activate_close, this);

  wow = new CoWowMotif( toplevel);
  trace_timerid = wow->timer_new();

  viewsetup();
  flow_Open( flow_ctx, filename);
  trasetup();
  trace_start();

#if defined OS_LINUX
  {
    struct stat info;

    if ( stat( filename, &info) != -1)
      version = info.st_ctime;    
  }
#endif

}
Exemplo n.º 29
0
/**************************************************************************
  Creates connect dialog.
**************************************************************************/
static void connectdlg_create(void)
{
  char buf[64];

  if (connectdlg_shell) {
    return;
  }

  connectdlg_shell =
    I_IN(I_T(XtCreatePopupShell("connectdialog", topLevelShellWidgetClass,
                                toplevel, NULL, 0)));
  connectdlg_form =
    XtVaCreateManagedWidget("connectform", formWidgetClass,
                            connectdlg_shell, NULL);

#if IS_BETA_VERSION
  connectdlg_beta_label =
    I_L(XtVaCreateManagedWidget("connbetalabel", labelWidgetClass,
                                connectdlg_form,
                                XtNresizable, True,
                                XtNjustify, XtJustifyCenter,
                                XtNlabel, beta_message(),
                                NULL));
#endif

  connectdlg_select_label =
    I_L(XtVaCreateManagedWidget("connselectlabel", labelWidgetClass,
                                connectdlg_form,
                                XtNresizable, True,
#if IS_BETA_VERSION
                                XtNfromVert, connectdlg_beta_label,
#endif
                                NULL));

  connectdlg_host_label =
    I_L(XtVaCreateManagedWidget("connhostlabel", labelWidgetClass,
                                connectdlg_form,
                                XtNresizable, True,
                                NULL));
  connectdlg_host_text =
    XtVaCreateManagedWidget("connhosttext", asciiTextWidgetClass,
                            connectdlg_form,
                            XtNeditType, XawtextEdit,
                            XtNstring, server_host,
                            NULL);
  connectdlg_port_label =
    I_L(XtVaCreateManagedWidget("connportlabel", labelWidgetClass,
                                connectdlg_form,
                                XtNresizable, True,
                                NULL));
  fc_snprintf(buf, sizeof(buf), "%d", server_port);
  connectdlg_port_text =
    XtVaCreateManagedWidget("connporttext", asciiTextWidgetClass,
                            connectdlg_form,
                            XtNeditType, XawtextEdit,
                            XtNstring, buf,
                            NULL);
  connectdlg_login_label =
    I_L(XtVaCreateManagedWidget("connloginlabel", labelWidgetClass,
                                connectdlg_form,
                                XtNresizable, True,
                                NULL));
  connectdlg_login_text =
    XtVaCreateManagedWidget("connlogintext", asciiTextWidgetClass,
                            connectdlg_form,
                            XtNeditType, XawtextEdit,
                            XtNstring, user_name,
                            NULL);
  connectdlg_password_label =
    I_L(XtVaCreateManagedWidget("connpasswordlabel", labelWidgetClass,
                                connectdlg_form,
                                XtNresizable, True,
                                NULL));
  connectdlg_password_text =
    XtVaCreateManagedWidget("connpasswordtext", asciiTextWidgetClass,
                            connectdlg_form,
                            XtNecho, False,
                            XtNsensitive, False,
                            NULL);
  connectdlg_verify_label =
    I_L(XtVaCreateManagedWidget("connverifylabel", labelWidgetClass,
                                connectdlg_form,
                                XtNresizable, True,
                                NULL));
  connectdlg_verify_text =
    XtVaCreateManagedWidget("connverifytext", asciiTextWidgetClass,
                            connectdlg_form,
                            XtNecho, False,
                            XtNsensitive, False,
                            NULL);
  connectdlg_message_label =
    I_L(XtVaCreateManagedWidget("connmessagelabel", labelWidgetClass,
                                connectdlg_form,
                                XtNresizable, True,
                                NULL));

  connectdlg_connect_button =
    I_L(XtVaCreateManagedWidget("connconnectbutton", commandWidgetClass,
                            connectdlg_form,
                            XtNlabel, _("Connect"),
                            NULL));
  connectdlg_lan_button =
    I_L(XtVaCreateManagedWidget("connlanbutton", commandWidgetClass,
                            connectdlg_form,
                            XtNlabel, _("LAN Servers"),
                            NULL));
  connectdlg_meta_button =
    I_L(XtVaCreateManagedWidget("connmetabutton", commandWidgetClass,
                            connectdlg_form,
                            XtNlabel, _("Metaserver"),
                            NULL));
  connectdlg_quit_button =
    I_L(XtVaCreateManagedWidget("connquitbutton", commandWidgetClass,
                            connectdlg_form,
                            XtNlabel, _("Quit"),
                            NULL));

  XtAddCallback(connectdlg_connect_button, XtNcallback,
                connectdlg_connect_callback, NULL);
  XtAddCallback(connectdlg_lan_button, XtNcallback,
                connectdlg_lan_callback, NULL);
  XtAddCallback(connectdlg_meta_button, XtNcallback,
                connectdlg_meta_callback, NULL);
  XtAddCallback(connectdlg_quit_button, XtNcallback,
                connectdlg_quit_callback, NULL);

  XtRealizeWidget(connectdlg_shell);
}
Exemplo n.º 30
0
int
main(int argc, char *argv[])
{
    Boolean		exists;
    char		*filename;
    FileAccess		file_access;
    Widget		source;
    XtAppContext	appcon;
    Boolean		show_dir;
    xedit_flist_item	*first_item;
    unsigned int	i, lineno;

    lineno = 0;
    show_dir = FALSE;
    first_item = NULL;

    topwindow = XtAppInitialize(&appcon, "Xedit", NULL, 0, &argc, argv,
				NULL,
				NULL, 0);

    XtAppAddActions(appcon, actions, XtNumber(actions));
    XtOverrideTranslations(topwindow,
			   XtParseTranslationTable("<Message>WM_PROTOCOLS: quit()"));

    XtGetApplicationResources(topwindow, (XtPointer) &app_resources, resources,
			      XtNumber(resources), NULL, 0);

    CurDpy = XtDisplay(topwindow);
    XawSimpleMenuAddGlobalActions(appcon);
    XtRegisterGrabAction(PopupMenu, True,
			 ButtonPressMask | ButtonReleaseMask,
			 GrabModeAsync, GrabModeAsync);

    makeButtonsAndBoxes(topwindow);

    StartHints();
    StartFormatPosition();
    (void)StartHooks(appcon);
    if (position_format_mask == 0) {
	for (i = 0; i < 3; i++)
	    XtRemoveCallback(texts[i], XtNpositionCallback,
			     PositionChanged, NULL);
    }
    XtRealizeWidget(topwindow);

#ifndef __UNIXOS2__
    XeditLispInitialize();
#endif

    options_popup = XtCreatePopupShell("optionsMenu", simpleMenuWidgetClass,
				       topwindow, NULL, 0);
    XtRealizeWidget(options_popup);
    XtAddCallback(XtCreateManagedWidget("ispell", smeBSBObjectClass,
					options_popup, NULL, 0),
		  XtNcallback, IspellCallback, NULL);
    CreateEditPopup();

    wm_delete_window = XInternAtom(XtDisplay(topwindow), "WM_DELETE_WINDOW",
				   False);
    (void)XSetWMProtocols(XtDisplay(topwindow), XtWindow(topwindow),
			  &wm_delete_window, 1);

    /* This first call is just to save the default font and colors */
    UpdateTextProperties(0);

    if (argc > 1) {
	xedit_flist_item	*item;
	Arg			args[2];
	unsigned int		num_args;

	for (i = 1; i < argc; i++) {
	    struct stat st;

	    if (argv[i][0] == '+') {
		char	*endptr;

		lineno = strtol(argv[i], &endptr, 10);
		/* Don't warn about incorrect input? */
		if (*endptr)
		    lineno = 0;
		continue;
	    }

	    filename = ResolveName(argv[i]);
	    if (filename == NULL || FindTextSource(NULL, filename) != NULL)
		continue;

	    num_args = 0;
	    if (stat(filename, &st) == 0 && !S_ISREG(st.st_mode)) {
		if (S_ISDIR(st.st_mode)) {
		    if (!first_item) {
			char path[BUFSIZ + 1];

			strncpy(path, filename, sizeof(path) - 2);
			path[sizeof(path) - 2] = '\0';
			if (*path) {
			    if (path[strlen(path) - 1] != '/')
				strcat(path, "/");
			}
			else
			    strcpy(path, "./");
			XtSetArg(args[0], XtNlabel, "");
			XtSetValues(dirlabel, args, 1);
			SwitchDirWindow(True);
			DirWindowCB(dirwindow, path, NULL);
			show_dir = True;
		    }
		    continue;
		}
	    }

	    switch (file_access = CheckFilePermissions(filename, &exists)) {
	    case NO_READ:
		if (exists)
		    XeditPrintf("File %s exists, and could not be opened for "
				"reading.\n", argv[i]);
		else
		    XeditPrintf("File %s does not exist, and the directory "
				"could not be opened for writing.\n", argv[i]);
		break;
	    case READ_OK:
		XtSetArg(args[num_args], XtNeditType, XawtextRead); num_args++;
		XeditPrintf("File %s opened READ ONLY.\n", argv[i]);
		break;
	    case WRITE_OK:
		XtSetArg(args[num_args], XtNeditType, XawtextEdit); num_args++;
		XeditPrintf("File %s opened read - write.\n", argv[i]);
		break;
	    }
	    if (file_access != NO_READ) {
		int flags;

		if (exists) {
		    flags = EXISTS_BIT;
		    XtSetArg(args[num_args], XtNstring, filename);num_args++;
		}
		else {
		    flags = 0;
		    XtSetArg(args[num_args], XtNstring, NULL);	  num_args++;
		}
		source = XtVaCreateWidget("textSource", international ?
					  multiSrcObjectClass
					  : asciiSrcObjectClass, topwindow,
					  XtNtype, XawAsciiFile,
					  XtNeditType, XawtextEdit,
					  NULL, NULL);
		XtSetValues(source, args, num_args);
		item = AddTextSource(source, argv[i], filename,
				     flags, file_access);
		XtAddCallback(item->source, XtNcallback, SourceChanged,
			      (XtPointer)item);
		if (exists && file_access == WRITE_OK) {
		    item->mode = st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
		    item->mtime = st.st_mtime;
		}
		if (!first_item && !show_dir)
		    first_item = item;
		ResetSourceChanged(item);
	    }
	}
    }

    if (!flist.pixmap && strlen(app_resources.changed_pixmap_name)) {
	XrmValue from, to;

	from.size = strlen(app_resources.changed_pixmap_name);
	from.addr = app_resources.changed_pixmap_name;
	to.size = sizeof(Pixmap);
	to.addr = (XtPointer)&(flist.pixmap);

	XtConvertAndStore(flist.popup, XtRString, &from, XtRBitmap, &to);
    }

    if (first_item == NULL) {
	XtSetKeyboardFocus(topwindow, filenamewindow);
	XtVaSetValues(textwindow, XtNwrap, XawtextWrapLine, NULL);
    }
    else {
	SwitchTextSource(first_item);
	XtSetKeyboardFocus(topwindow, textwindow);
	if (lineno) {
	    XawTextPosition position;

	    source = XawTextGetSource(textwindow);
	    position = RSCAN(XawTextGetInsertionPoint(textwindow),
			     lineno, False);
	    position = LSCAN(position, 1, False);
	    XawTextSetInsertionPoint(textwindow, position);
	}
    }

    XtAppMainLoop(appcon);
    return EXIT_SUCCESS;
}