Exemplo n.º 1
0
static void
BrowseCallback(Widget w, XtPointer client_data, XtPointer call_data)
{
#ifdef DEBUG
    printf("%s:BrowseCallback(%d) - %s\n", __FILE__, __LINE__, XtName(w));
#endif
    if (FilePicker_FileSelectionDialog(XtParent(w)) == NULL)
    {
#ifdef DEBUG
	printf("%s:BrowseCallback(%d) - %s creating FSB\n", __FILE__, __LINE__, XtName(w));
#endif
    	if (FilePickerClass_FileSelectionDialog(XtParent(w)) == NULL)
    	{
    	Widget Shell = XtParent(w);

#ifdef DEBUG
	    printf("%s:BrowseCallback(%d) - %s creating class FSB\n", __FILE__, __LINE__, XtName(w));
#endif
	    while (!XtIsShell(Shell)) Shell = XtParent(Shell);
	    FilePickerClass_FileSelectionDialog(XtParent(w)) = XmCreateFileSelectionDialog(Shell, "FilePickerDialog", NULL, 0);
    	}
    	FilePicker_FileSelectionDialog(XtParent(w)) = FilePickerClass_FileSelectionDialog(XtParent(w));
    }
    XtRemoveAllCallbacks(FilePicker_FileSelectionDialog(XtParent(w)), XmNokCallback);
    XtRemoveAllCallbacks(FilePicker_FileSelectionDialog(XtParent(w)), XmNcancelCallback);
    XtAddCallback(FilePicker_FileSelectionDialog(XtParent(w)), XmNokCallback, (XtCallbackProc)BrowseOkCallback, XtParent(w));
    XtAddCallback(FilePicker_FileSelectionDialog(XtParent(w)), XmNcancelCallback, (XtCallbackProc)XtUnmanageChild, NULL);
    XtManageChild(FilePicker_FileSelectionDialog(XtParent(w)));
}
Exemplo n.º 2
0
static void CancelPlotCB(Widget, XtPointer client_data, XtPointer)
{
    static bool entered = false;
    if (entered)
	return;

    entered = true;

    PlotWindowInfo *plot = (PlotWindowInfo *)client_data;
    popdown_plot_shell(plot);

    if (plot->swallower != 0)
    {
	// Don't wait for window to swallow
	XtRemoveAllCallbacks(plot->swallower, XtNwindowCreatedCallback);
	XtRemoveAllCallbacks(plot->swallower, XtNwindowGoneCallback);
    }

    if (plot->swallow_timer != 0)
    {
	XtRemoveTimeOut(plot->swallow_timer);
	plot->swallow_timer = 0;
    }

    if (plot->plotter != 0)
    {
	// Terminate plotter
	plot->plotter->removeHandler(Died, PlotterNotFoundHP, client_data);
	plot->plotter->terminate();
	plot->plotter = 0;
    }

    entered = false;
}
Exemplo n.º 3
0
void
ws_reassociate_ws_window(PceWindow from, PceWindow to)
{ Widget w = widgetWindow(from);

  if ( w )
  { XtRemoveAllCallbacks(w, XtNeventCallback);
    XtRemoveAllCallbacks(w, XtNexposeCallback);
    XtRemoveAllCallbacks(w, XtNresizeCallback);
    setWidgetWindow(from, NULL);

    setWidgetWindow(to, w);
    XtAddCallback(w, XtNeventCallback,  event_window, to);
    XtAddCallback(w, XtNexposeCallback, expose_window, to);
    XtAddCallback(w, XtNresizeCallback, resize_window, to);
  }
}
Exemplo n.º 4
0
static Widget create_tool_controls_dialog(
  Widget	topl)
{
    Widget	dialog, control, form;

    dialog = HGU_XmCreateStdDialog(topl, "tool_control_dialog",
				   xmFormWidgetClass, NULL, 0);

    control = XtNameToWidget( dialog, "*.Cancel" );
    XtRemoveAllCallbacks(control, XmNactivateCallback);
    XtAddCallback(control, XmNactivateCallback,
		  UnmanageChildCb, (XtPointer) dialog);

    control = XtNameToWidget( dialog, "*.control" );

    form = CreateDrawPaintBallControls( control );
    (void) CreateThresholdControls( control );
    (void) CreateGeometryObjectControls( control );
    (void) CreateFillControls( control );
    (void) CreateMorphologicalControls( control );
    (void) CreateAffineControls( control );
    (void) CreateTracking2DControls( control );
    (void) CreateEdgeTracking2DControls( control );
#if !defined (LINUX2) && !defined (DARWIN) && !defined (SUNOS5)
    (void) CreateTabletControls( control );
#endif /* LINUX2 */

    XtManageChild( form );

  return( dialog );
}
Exemplo n.º 5
0
void
ws_uncreate_window(PceWindow sw)
{ Widget w;

  if ( grabbedWindows )
    deleteChain(grabbedWindows, sw);

  if ( (w=widgetWindow(sw)) )
  { XtRemoveAllCallbacks(w, XtNeventCallback);
    XtRemoveAllCallbacks(w, XtNexposeCallback);
    XtRemoveAllCallbacks(w, XtNresizeCallback);
    XtRemoveAllCallbacks(w, XtNdestroyCallback);

    destroy_window(w, (XtPointer)sw, NULL); /* callback may be delayed */
    XtDestroyWidget(w);			    /* too long */

  }
}
Exemplo n.º 6
0
void	InitWorkWindow()
{ 
    Arg args[2];
	
	workwin =XtNameToWidget(mainwin,"ScrollArea");
	XtSetArg(args[0],XmNhorizontalScrollBar,&sb1);
	XtSetArg(args[1],XmNverticalScrollBar,&sb2);
	XtGetValues(workwin,args,2);
	
	XtRemoveAllCallbacks(sb1,XmNdragCallback);
	XtRemoveAllCallbacks(sb2,XmNdragCallback);
	
	/*    InitMouseHelp(); */
	
    drawwin=XtNameToWidget(workwin,"*DrawWin");
    XtAddEventHandler( drawwin, ButtonPressMask, FALSE, PopPopupEH, NULL );
    XtAddEventHandler( drawwin, PointerMotionMask, FALSE, PopPopupEH, NULL );
	   	
    statuswin=XtNameToWidget(mainwin,"*StatusArea");
	ModifyArea = XtNameToWidget(mainwin,"*ModifyArea");
    currentaction=XtNameToWidget(mainwin,"*CurrentAction");
 	
}
Exemplo n.º 7
0
/****************************************************************
...
*****************************************************************/
void city_dialog_update_present_units(struct city_dialog *pdialog, int unitid)
{
  int i;
  struct genlist_iterator myiter;
  struct unit *punit;

  if(unitid) {
    for(i=0; i<NO_UNITS_SHOWN; i++)
      if(pdialog->present_unit_ids[i]==unitid)
	break;
    if(i==NO_UNITS_SHOWN)
      unitid=0;
  }

  genlist_iterator_init(&myiter, 
	&map_get_tile(pdialog->pcity->x, pdialog->pcity->y)->units.list, 0);
  
  for(i=0; ITERATOR_PTR(myiter); ITERATOR_NEXT(myiter), i++) {
    punit=(struct unit*)ITERATOR_PTR(myiter);
    
    if(unitid && punit->id!=unitid)
      continue;
    
    
    put_unit_pixmap(punit, XawPixcommPixmap(pdialog->present_unit_pixcomms[i]),
		    0, 0);
    
    put_unit_pixmap_city_overlays(punit, 
			  XawPixcommPixmap(pdialog->present_unit_pixcomms[i]),
				  0,0);
    xaw_expose_now(pdialog->present_unit_pixcomms[i]);
    pdialog->present_unit_ids[i]=punit->id;
    
    XtRemoveAllCallbacks(pdialog->present_unit_pixcomms[i], XtNcallback);
    XtAddCallback(pdialog->present_unit_pixcomms[i], XtNcallback, 
		  present_units_callback, (XtPointer)punit->id);
    XtSetSensitive(pdialog->present_unit_pixcomms[i], TRUE);
  }
  
  for(; i<NO_UNITS_SHOWN; i++) {
    XawPixcommClear(pdialog->present_unit_pixcomms[i]);
    pdialog->present_unit_ids[i]=0;
    XtSetSensitive(pdialog->present_unit_pixcomms[i], FALSE);
  }
}
Exemplo n.º 8
0
static void 
PromptSensitivityLevel( void)
{

    Dimension	width;
    int		i, width1, width2;

    /*
     *  Use the password widget set to prompt for the B1 Sensitivity Level.
     *  Remember to put it back to normal if the user presses [Clear].
     */
     
    normalPasswordWidget = False;
    
    XtRemoveAllCallbacks(_text, XmNmodifyVerifyCallback);
    XmTextFieldSetString(_text,"");


    /*
     *  Change the label and resize the password form...
     */
     
    i = 0;
    XtSetArg(argt[i], XmNresizable,		True			); i++;
    XtSetArg(argt[i], XmNresizePolicy,		XmRESIZE_ANY		); i++;
    XtSetValues(_form, argt, i);

    i = 0;
    xmstr = ReadCatalogXms(MC_LABEL_SET, -1, "Sensitivity Level:");
    XtSetArg(argt[i], XmNrecomputeSize,		True			); i++;
    XtSetArg(argt[i], XmNlabelString,		xmstr			); i++;
    XtSetValues(_label, argt, i);

    XmStringFree(xmstr);
    
    /*
     *  Center the form horizontally in the login_matte...
     *
     */

    CenterForm(matte1, _form);
    
    ProcessTraversal(_text, XmTRAVERSE_CURRENT);

}
Exemplo n.º 9
0
void do_props_proc(Widget w, XtPointer client_data, XtPointer call_data)
{
    int x, y;
    static Widget top, acceptcallback;
    Widget dialog;
    EditPoints *ep = (EditPoints *) client_data;

    set_wait_cursor();
    if (top == NULL) {
	Widget but1[2];
	char *label1[2];
	label1[0] = "Accept";
	label1[1] = "Close";
	XmGetPos(app_shell, 0, &x, &y);
	top = XmCreateDialogShell(app_shell, "Edit set props", NULL, 0);
	handle_close(top);
	XtVaSetValues(top, XmNx, x, XmNy, y, NULL);
	dialog = XmCreateRowColumn(top, "dialog_rc", NULL, 0);

	editp_col_item = CreatePanelChoice(dialog, "Apply to column:",
				    8, "1", "2", "3", "4", "5", "6", "All",
					   NULL, 0);

	editp_format_item = CreatePanelChoice(dialog, "Format:",
					      4,
					      "Decimal",
					      "General",
					      "Exponential",
					      NULL, 0);

	editp_precision_item = CreatePanelChoice(dialog, "Precision:",
						 16,
						 "0", "1", "2", "3", "4",
						 "5", "6", "7", "8", "9",
						 "10", "11", "12", "13", "14",
						 NULL, 0);

	editp_width_item = CreatePanelChoice0(dialog, "Width:",
					5, 21,
				"1", "2", "3", "4", "5",
				"6", "7", "8", "9", "10", 
				"11", "12", "13", "14", "15",
				"16", "17", "18", "19", "20",
					NULL, 0);

	XtVaCreateManagedWidget("sep", xmSeparatorWidgetClass, dialog, NULL);

	CreateCommandButtons(dialog, 2, but1, label1);
	XtAddCallback(but1[0], XmNactivateCallback,
	    	(XtCallbackProc) do_accept_props, (XtPointer) ep);
	XtAddCallback(but1[1], XmNactivateCallback,
	    	(XtCallbackProc) destroy_dialog, (XtPointer) top);
	XtManageChild(dialog);
	acceptcallback = but1[0];
    }
    XtRemoveAllCallbacks(acceptcallback, XmNactivateCallback);
    XtAddCallback(acceptcallback, XmNactivateCallback,
    	    (XtCallbackProc) do_accept_props, (XtPointer) ep);
    update_props(ep);
    XtRaise(top);
    unset_wait_cursor();
}
Exemplo n.º 10
0
// Create a new plot window
PlotAgent *new_plotter(const string& name, DispValue *source)
{
    static int tics = 1;

    string cmd = app_data.plot_command;
    cmd.gsub("@FONT@", make_font(app_data, FixedWidthDDDFont));

    string window_name = ddd_NAME "plot" + itostring(tics++);
    if (cmd.contains("@NAME@"))
	cmd.gsub("@NAME@", window_name);
    else
	cmd += " -name " + window_name;

    // Create shell
    PlotWindowInfo *plot = new_decoration(name);
    if (plot == 0)
	return 0;

    plot->source      = source;
    plot->window_name = window_name;
    XtVaSetValues(plot->shell, XmNuserData, XtPointer(True), XtPointer(0));

    // Pop up a working dialog
    static Widget dialog = 0;
    if (dialog == 0)
    {
	Arg args[10];
	Cardinal arg = 0;
	dialog = verify(XmCreateWorkingDialog(find_shell(),
					      XMST("launch_plot_dialog"), 
					      args, arg));
	XtUnmanageChild(XmMessageBoxGetChild(dialog,
					     XmDIALOG_OK_BUTTON));
	XtUnmanageChild(XmMessageBoxGetChild(dialog,
					     XmDIALOG_HELP_BUTTON));
    }

    XtRemoveAllCallbacks(dialog, XmNcancelCallback);
    XtAddCallback(dialog, XmNcancelCallback, CancelPlotCB, XtPointer(plot));
    plot->working_dialog = dialog;

    string base = cmd;
    if (base.contains(' '))
	base = cmd.before(' ');
    MString msg = rm("Starting ") + tt(base) + rm("...");
    XtVaSetValues(dialog, XmNmessageString, msg.xmstring(), XtPointer(0));
    manage_and_raise(dialog);
    wait_until_mapped(dialog);

    // Invoke plot process
    PlotAgent *plotter = 
	new PlotAgent(XtWidgetToApplicationContext(plot->shell), cmd);

    XtAddCallback(plot->shell, XtNpopdownCallback,
		  CancelPlotCB, XtPointer(plot));

    if (plot->area != 0)
    {
	XtAddCallback(plot->area->widget(), XmNexposeCallback,
		      ExposePlotAreaCB, XtPointer(plot));
	XtAddCallback(plot->area->widget(), XmNresizeCallback,
		      ResizePlotAreaCB, XtPointer(plot));
    }

    string init = app_data.plot_init_commands;
    init.prepend("set term " + string(app_data.plot_term_type) + "\n");
    if (!init.empty() && !init.contains('\n', -1))
	init += '\n';

    // Add trace handlers
    plotter->addHandler(Input,  TraceInputHP);     // Gnuplot => DDD
    plotter->addHandler(Output, TraceOutputHP);    // DDD => Gnuplot
    plotter->addHandler(Error,  TraceErrorHP);     // Gnuplot Errors => DDD

    // Show Gnuplot Errors in status line
    plotter->addHandler(Error,  SetStatusHP,       (void *)plot);

    // Handle death
    plotter->addHandler(Died, PlotterNotFoundHP, (void *)plot);
    plotter->addHandler(Died, DeletePlotterHP,   (void *)plot);

    if (plot->area != 0)
	plotter->addHandler(Plot, GetPlotHP, (void *)plot);

    plotter->start_with(init);
    plot->plotter = plotter;

    return plotter;
}
Exemplo n.º 11
0
static PlotWindowInfo *new_decoration(const string& name)
{
    PlotWindowInfo *plot = 0;

    // Check whether we can reuse an existing decoration
    for (int i = 0; i < plot_infos.size(); i++)
    {
	PlotWindowInfo *info = (PlotWindowInfo *)plot_infos[i];
	if (info->plotter == 0)
	{
	    // Shell is unused - use this one
	    plot = info;
	    break;
	}
    }

    if (plot == 0)
    {
	plot = new PlotWindowInfo;

	// Create decoration windows
	Arg args[10];
	Cardinal arg = 0;
	XtSetArg(args[arg], XmNallowShellResize, True);       arg++;
	XtSetArg(args[arg], XmNdeleteResponse, XmDO_NOTHING); arg++;

	// Mark shell as `used'
	XtSetArg(args[arg], XmNuserData, XtPointer(True)); arg++;
	plot->shell = verify(XtCreateWidget("plot", topLevelShellWidgetClass,
					    find_shell(), args, arg));

	AddDeleteWindowCallback(plot->shell, CancelPlotCB, XtPointer(plot));

	arg = 0;
	Widget main_window = XmCreateMainWindow(plot->shell, 
						XMST("main_window"), 
						args, arg);
	XtManageChild(main_window);

	MMcreateMenuBar(main_window, "menubar", menubar);
	MMaddCallbacks(file_menu,    XtPointer(plot));
	MMaddCallbacks(simple_edit_menu);
	MMaddCallbacks(view_menu,    XtPointer(plot));
	MMaddCallbacks(plot_menu,    XtPointer(plot));
	MMaddCallbacks(scale_menu,   XtPointer(plot));
	MMaddCallbacks(contour_menu, XtPointer(plot));
	MMaddCallbacks(simple_help_menu);
	MMaddHelpCallback(menubar, ImmediateHelpCB);

	arg = 0;
	XtSetArg(args[arg], XmNscrollingPolicy, XmAPPLICATION_DEFINED); arg++;
	XtSetArg(args[arg], XmNvisualPolicy,    XmVARIABLE);            arg++;
	Widget scroll = 
	    XmCreateScrolledWindow(main_window, XMST("scroll"), args, arg);
	XtManageChild(scroll);

	// Create work window
	Widget work;
	string plot_term_type = downcase(app_data.plot_term_type);
	if (plot_term_type.contains("xlib", 0))
	{
	    // xlib type - create plot area to draw plot commands
	    arg = 0;
	    work = XmCreateDrawingArea(scroll, 
				       XMST(PLOT_AREA_NAME), args, arg);
	    XtManageChild(work);

	    plot->area = 
		new PlotArea(work, make_font(app_data, FixedWidthDDDFont));
	    XtVaSetValues(work, XmNuserData, XtPointer(plot->area), 
			  XtPointer(0));
	}
	else if (plot_term_type.contains("x11", 0))
	{
	    // x11 type - swallow Gnuplot window
	    arg = 0;
	    work = plot->swallower = 
		XtCreateManagedWidget(SWALLOWER_NAME, swallowerWidgetClass, 
				      scroll, args, arg);
	}
	else
	{
	    // Unknown terminal type
	    post_error("Unknown plot terminal type " + 
		       quote(app_data.plot_term_type),
		       "unknown_plot_term_type_error");
	    return 0;
	}

	// Create scroll bars
	const int slider_size = 20;

	arg = 0;
	XtSetArg(args[arg], XmNorientation, XmHORIZONTAL);      arg++;
	XtSetArg(args[arg], XmNminimum,     0);                 arg++;
	XtSetArg(args[arg], XmNmaximum,     360 + slider_size); arg++;
	plot->hsb = XmCreateScrollBar(scroll, XMST("hsb"), args, arg);
	XtManageChild(plot->hsb);

	arg = 0;
	XtSetArg(args[arg], XmNorientation, XmVERTICAL);        arg++;
	XtSetArg(args[arg], XmNminimum,     0);                 arg++;
	XtSetArg(args[arg], XmNmaximum,     180 + slider_size); arg++;
	plot->vsb = XmCreateScrollBar(scroll, XMST("vsb"), args, arg);
	XtManageChild(plot->vsb);

	XtAddCallback(plot->hsb, XmNvalueChangedCallback,
		      SetViewCB, XtPointer(plot));
	XtAddCallback(plot->vsb, XmNvalueChangedCallback,
		      SetViewCB, XtPointer(plot));

#if 0
	XtAddCallback(plot->hsb, XmNdragCallback, SetViewCB, XtPointer(plot));
	XtAddCallback(plot->vsb, XmNdragCallback, SetViewCB, XtPointer(plot));
#endif

	XmScrolledWindowSetAreas(scroll, plot->hsb, plot->vsb, work);

	Delay::register_shell(plot->shell);
	InstallButtonTips(plot->shell);

	plot_infos += plot;
    }

    string title = DDD_NAME ": " + name;
    XtVaSetValues(plot->shell,
		  XmNtitle, title.chars(),
		  XmNiconName, title.chars(),
		  XtPointer(0));

    if (plot->swallower != 0)
    {
	XtRemoveAllCallbacks(plot->swallower, XtNwindowCreatedCallback);
	XtAddCallback(plot->swallower, XtNwindowCreatedCallback,
		      SwallowCB, XtPointer(plot));

	XtRemoveAllCallbacks(plot->swallower, XtNwindowGoneCallback);
	XtAddCallback(plot->swallower, XtNwindowGoneCallback, 
		      SwallowAgainCB, XtPointer(plot));

	if (plot->swallow_timer != 0)
	    XtRemoveTimeOut(plot->swallow_timer);

	plot->swallow_timer = 
	    XtAppAddTimeOut(XtWidgetToApplicationContext(plot->swallower),
			    app_data.plot_window_delay, SwallowTimeOutCB, 
			    XtPointer(plot));
    }

    plot->active = false;

    return plot;
}
Exemplo n.º 12
0
 Widget wid_posiz(Widget iw_parent, Widget iw_posiz, int ixt, int iyt, 
                  int icolst, int irowst, char ctype, void (*call)(void))
 {
 Widget        iw_rowcol, iw_dum; 
 char          cval[5];

 ix_posiz    = ixt;    iy_posiz    = iyt;
 icols_posiz = icolst; irows_posiz = irowst;

 if (iw_posiz == (Widget)0) 
    {
    /* Create a  new dialog widget for iw_posiz */
    iw_posiz  = wid_dialog(iw_parent,0, "position",-1,-1);

    /* Create a RowColumn widget within iw_posiz */
    iw_rowcol = wid_rowcol(iw_posiz, 'v', -1, -1);

    /*--------------- Position portion of widget ----------------*/

    /* Create a label widget with default alignment */
    iw_title1 = wid_labelg(iw_rowcol, 0, 
                "Enter X & Y position (in pixels)", -1,-1);

    /* Create a parent for the prompts and labels */
    iw_rowcol1  = wid_rowcol(iw_rowcol, 'h', -1, -1);

    /* Create a label and text box for ix */
    sprintf(cval,"%4d",ix_posiz);
    iw_ix = wid_textboxb(iw_rowcol1,0,"X:   ",cval,4);
    sprintf(cval,"%4d",iy_posiz);
    iw_iy = wid_textboxb(iw_rowcol1,0,"Y:   ",cval,4);

    if (ctype == 's'  || ctype == 'S' )
       {
       XtUnmanageChild(iw_title1);
       XtUnmanageChild(iw_rowcol1);
       }
 
    /*------------------- Size portion of widget ----------------*/

    /* Create a label widget with default alignment */
    iw_title2 = wid_labelg(iw_rowcol, 0, 
                        "Enter cols. & rows (in pixels)", -1,-1);

    /* Create a rowcol parent for the prompts and labels */
    iw_rowcol2  = wid_rowcol(iw_rowcol, 'h', -1, -1);

    /* create a label and text box for width & height */
    sprintf(cval,"%4d",icols_posiz);
    iw_icols = wid_textboxb(iw_rowcol2,0,"COLS:",cval,4);
    sprintf(cval,"%4d",irows_posiz);
    iw_irows = wid_textboxb(iw_rowcol2,0,"ROWS:",cval,4);

    if (ctype == 'P'  || ctype == 'p' )
       {
       XtUnmanageChild(iw_title2);
       XtUnmanageChild(iw_rowcol2);
       }
   
   /* Create a separator for consistancy with other pop up dialogs */
   wid_sep(iw_rowcol);

   iw_dum = wid_stdbut(iw_rowcol, iw_posiz, &iw_dum, &iw_pushc, &iw_pusha, 
                       "CA",fin_cb,fin_cb, wid_posiz_buta, (void *) call);
   }

 else 
    {
    /* Update widget for iw_posiz */
    iw_posiz  = wid_dialog(iw_parent,iw_posiz, "position",-1,-1);

    XtRemoveAllCallbacks(iw_pusha,XmNactivateCallback); 
    XtAddCallback(iw_pusha,XmNactivateCallback,
                   wid_posiz_buta, (XtPointer) call);

    if (ctype == 'p' || ctype == 'b' || ctype == 'P' || ctype == 'B' )
       {
       /* Update label and text box for ix */
       sprintf(cval,"%4d",ix_posiz);
       iw_ix = wid_textboxb(iw_rowcol1,iw_ix,"X:",cval,4);
       sprintf(cval,"%4d",iy_posiz);
       iw_iy = wid_textboxb(iw_rowcol1,iw_iy,"Y:",cval,4);

       XtManageChild(iw_title1);
       XtManageChild(iw_rowcol1);
       }
    if (ctype == 'P'  || ctype == 'p' )
       {
       XtUnmanageChild(iw_title2);
       XtUnmanageChild(iw_rowcol2);
       }
  
    if (ctype == 's' || ctype == 'b' || ctype == 'S' || ctype == 'B' )
       {
       /* Update text box for cols & rows */
       sprintf(cval,"%4d",icols_posiz);
       iw_icols = wid_textboxb(iw_rowcol2,iw_icols,"COLS:",cval,4);
       sprintf(cval,"%4d",irows_posiz);
       iw_irows = wid_textboxb(iw_rowcol2,iw_irows,"ROWS:",cval,4);
       XtManageChild(iw_title2);
       XtManageChild(iw_rowcol2); 
       }
    if (ctype == 'P'  || ctype == 'p' )
       {
       XtUnmanageChild(iw_title2);
       XtUnmanageChild(iw_rowcol2);
       }
    if (ctype == 's'  || ctype == 'S' )
       {
       XtUnmanageChild(iw_title1);
       XtUnmanageChild(iw_rowcol1);
       }
    }

 XtManageChild(iw_posiz);

 iw_posizt = iw_posiz;
 return iw_posiz;
 }
Exemplo n.º 13
0
/****************************************************************
...
*****************************************************************/
void city_dialog_update_citizens(struct city_dialog *pdialog)
{
  int i, n;
  struct city *pcity=pdialog->pcity;
    
  for(i=0, n=0; n<pcity->ppl_happy[4] && i<NO_CITIZENS_SHOWN; n++, i++)
    if(pdialog->citizen_type[i]!=5 &&  pdialog->citizen_type[i]!=6) {
      pdialog->citizen_type[i]=5+i%2;
      xaw_set_bitmap(pdialog->citizen_labels[i], 
		     get_citizen_pixmap(pdialog->citizen_type[i]));
      XtSetSensitive(pdialog->citizen_labels[i], FALSE);
      XtRemoveAllCallbacks(pdialog->citizen_labels[i], XtNcallback);
    }

  for(n=0; n<pcity->ppl_content[4] && i<NO_CITIZENS_SHOWN; n++, i++)
    if(pdialog->citizen_type[i]!=3 && pdialog->citizen_type[i]!=4) {
      pdialog->citizen_type[i]=3+i%2;
      xaw_set_bitmap(pdialog->citizen_labels[i], 
		     get_citizen_pixmap(pdialog->citizen_type[i]));
      XtSetSensitive(pdialog->citizen_labels[i], FALSE);
      XtRemoveAllCallbacks(pdialog->citizen_labels[i], XtNcallback);
    }
      
  for(n=0; n<pcity->ppl_unhappy[4] && i<NO_CITIZENS_SHOWN; n++, i++)
    if(pdialog->citizen_type[i]!=7) {
      xaw_set_bitmap(pdialog->citizen_labels[i], get_citizen_pixmap(7));
      pdialog->citizen_type[i]=7;
      XtRemoveAllCallbacks(pdialog->citizen_labels[i], XtNcallback);
      XtSetSensitive(pdialog->citizen_labels[i], FALSE);
    }
      
  for(n=0; n<pcity->ppl_elvis && i<NO_CITIZENS_SHOWN; n++, i++)
    if(pdialog->citizen_type[i]!=0) {
      xaw_set_bitmap(pdialog->citizen_labels[i], get_citizen_pixmap(0));
      pdialog->citizen_type[i]=0;
      XtRemoveAllCallbacks(pdialog->citizen_labels[i], XtNcallback);
      XtAddCallback(pdialog->citizen_labels[i], XtNcallback, elvis_callback,
		    (XtPointer)pdialog);
      XtSetSensitive(pdialog->citizen_labels[i], TRUE);
    }

  
  for(n=0; n<pcity->ppl_scientist && i<NO_CITIZENS_SHOWN; n++, i++)
    if(pdialog->citizen_type[i]!=1) {
      xaw_set_bitmap(pdialog->citizen_labels[i], get_citizen_pixmap(1));
      pdialog->citizen_type[i]=1;
      XtRemoveAllCallbacks(pdialog->citizen_labels[i], XtNcallback);
      XtAddCallback(pdialog->citizen_labels[i], XtNcallback, scientist_callback,
		    (XtPointer)pdialog);
      XtSetSensitive(pdialog->citizen_labels[i], TRUE);
    }
  
  for(n=0; n<pcity->ppl_taxman && i<NO_CITIZENS_SHOWN; n++, i++)
    if(pdialog->citizen_type[i]!=2) {
      xaw_set_bitmap(pdialog->citizen_labels[i], get_citizen_pixmap(2));
      pdialog->citizen_type[i]=2;
      XtRemoveAllCallbacks(pdialog->citizen_labels[i], XtNcallback);
      XtAddCallback(pdialog->citizen_labels[i], XtNcallback, taxman_callback,
		    (XtPointer)pdialog);
      XtSetSensitive(pdialog->citizen_labels[i], TRUE);
    }
  
  for(; i<NO_CITIZENS_SHOWN; i++) {
    xaw_set_bitmap(pdialog->citizen_labels[i], None);
    XtSetSensitive(pdialog->citizen_labels[i], FALSE);
    XtRemoveAllCallbacks(pdialog->citizen_labels[i], XtNcallback);
  }
}
Exemplo n.º 14
0
void
xaw_update_one_widget (widget_instance *instance, Widget widget,
		       widget_value *val, Boolean UNUSED (deep_p))
{
  if (0)
    ;
#ifdef LWLIB_SCROLLBARS_ATHENA
  else if (XtIsSubclass (widget, scrollbarWidgetClass))
    {
      xaw_update_scrollbar (instance, widget, val);
    }
#endif
#ifdef LWLIB_WIDGETS_ATHENA
#ifndef NEED_MOTIF
  else if (XtIsSubclass (widget, asciiTextWidgetClass))
      {
      }
#endif
#endif
#ifdef LWLIB_DIALOGS_ATHENA
  else if (XtIsSubclass (widget, dialogWidgetClass))
    Xt_SET_VALUE (widget, XtNlabel, val->contents->value);
#endif /* LWLIB_DIALOGS_ATHENA */
#ifdef LWLIB_WIDGETS_ATHENA
  else if (XtClass (widget) == labelWidgetClass)
    Xt_SET_VALUE (widget, XtNlabel, val->value);
#endif /* LWLIB_WIDGETS_ATHENA */
#if defined (LWLIB_DIALOGS_ATHENA) || defined (LWLIB_WIDGETS_ATHENA)
  else if (XtIsSubclass (widget, commandWidgetClass))
    {
      Arg al [3];

#ifndef LWLIB_DIALOGS_ATHENA3D
      {
	Dimension bw = 0;
	Xt_GET_VALUE (widget, XtNborderWidth, &bw);
	if (bw == 0)
	  /* Don't let buttons end up with 0 borderwidth, that's ugly...
	     Yeah, all this should really be done through app-defaults files
	     or fallback resources, but that's a whole different can of worms
	     that I don't feel like opening right now.  Making Athena widgets
	     not look like shit is just entirely too much work.
	  */
	  Xt_SET_VALUE (widget, XtNborderWidth, 1);
	}
#endif /* ! LWLIB_DIALOGS_ATHENA3D */

      lw_remove_accelerator_spec (val->value);
      Xt_SET_ARG (al [0], XtNlabel,     val->value);
      Xt_SET_ARG (al [1], XtNsensitive, val->enabled);
      /* Force centered button text.  See above. */
      Xt_SET_ARG (al [2], XtNjustify, XtJustifyCenter);
      XtSetValues (widget, al, 3);

      XtRemoveAllCallbacks (widget, XtNcallback);
      XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance);
#ifdef LWLIB_WIDGETS_ATHENA
      /* set the selected state */
      if (XtIsSubclass (widget, toggleWidgetClass))
	Xt_SET_VALUE (widget, XtNstate, val->selected);
#endif /* LWLIB_WIDGETS_ATHENA */
    }
#endif /* LWLIB_DIALOGS_ATHENA */
  /* Lastly update our global arg values. */
  if (val->args && val->args->nargs)
    XtSetValues (widget, val->args->args, val->args->nargs);
}
Exemplo n.º 15
0
/*!
* \ingroup	HGU_GL
* \brief	Destroy Method: Destroys/frees trackball stuff.
* \param	givenW			Given widget.
*/
static void     Destroy(Widget givenW)
{
  XtRemoveAllCallbacks(givenW, HGUglwNtrackballCallback);
}
Exemplo n.º 16
0
void
XmLDrawnButtonSetType(Widget w,
		      int drawnType,
		      int drawnDir)
	{
	XmLDrawnBData *dd;
	XmDrawnButtonWidget b;
	XmString str;
	XmFontList fontlist;
	XGCValues values;
	XtGCMask mask;
	Dimension width, height, dim;
	Dimension highlightThickness, shadowThickness;
	Dimension marginWidth, marginHeight;
	Dimension marginTop, marginBottom, marginLeft, marginRight;

	if (!XtIsSubclass(w, xmDrawnButtonWidgetClass))
		{
		XmLWarning(w, "DrawnButtonSetType() - not an XmDrawnButton");
		return;
		}
	XtVaSetValues(w,
		XmNpushButtonEnabled, True,
		NULL);
	XtRemoveAllCallbacks(w, XmNexposeCallback);
	XtRemoveAllCallbacks(w, XmNresizeCallback);
	if (drawnType == XmDRAWNB_STRING && drawnDir == XmDRAWNB_RIGHT)
		{
		XtVaSetValues(w,
			XmNlabelType, XmSTRING,
			NULL);
		return;
		}
	b = (XmDrawnButtonWidget)w;
	dd = (XmLDrawnBData *)malloc(sizeof(XmLDrawnBData));
	dd->type = drawnType;
	dd->dir = drawnDir;
	dd->gc = 0;
	if (dd->type == XmDRAWNB_STRING)
		{
		XtVaGetValues(w,
			XmNlabelString, &str,
			XmNfontList, &fontlist,
			XmNhighlightThickness, &highlightThickness,
			XmNshadowThickness, &shadowThickness,
			XmNmarginHeight, &marginHeight,
			XmNmarginWidth, &marginWidth,
			XmNmarginTop, &marginTop,
			XmNmarginBottom, &marginBottom,
			XmNmarginLeft, &marginLeft,
			XmNmarginRight, &marginRight,
			NULL);
		if (!str && XtName(w))
			str = XmStringCreateSimple(XtName(w));
		if (!str)
			str = XmStringCreateSimple("");
		XmStringExtent(fontlist, str, &width, &height);
		XmStringFree(str);
		if (drawnDir == XmDRAWNB_UP || drawnDir == XmDRAWNB_DOWN)
			{
			dim = width;
			width = height;
			height = dim;
			}
		height += (highlightThickness + shadowThickness +
			marginHeight) * 2 + marginTop + marginBottom;
		width += (highlightThickness + shadowThickness +
			marginWidth) * 2 + marginLeft + marginRight;
		/* change to pixmap type so label string isnt drawn */
		XtVaSetValues(w,
			XmNlabelType, XmPIXMAP,
			NULL);
		XtVaSetValues(w,
			XmNwidth, width,
			XmNheight, height,
			NULL);
		XtAddCallback(w, XmNexposeCallback, XmLDrawnBDrawStringCB,
			(XtPointer)dd);
		XtAddCallback(w, XmNresizeCallback, XmLDrawnBDrawStringCB,
			(XtPointer)dd);
		}
	else
		{
		mask = GCForeground;
		values.foreground = b->primitive.foreground;
		dd->gc = XtGetGC(w, mask, &values);
		XtAddCallback(w, XmNexposeCallback, XmLDrawnBDrawCB, (XtPointer)dd);
		XtAddCallback(w, XmNresizeCallback, XmLDrawnBDrawCB, (XtPointer)dd);
		}
	XtAddCallback(w, XmNdestroyCallback, XmLDrawnBDestroyCB, (XtPointer)dd);
	}
Exemplo n.º 17
0
void
xaw_update_one_widget (widget_instance *instance,
                       Widget widget,
                       widget_value *val,
                       Boolean deep_p)
{
    if (XtIsSubclass (widget, dialogWidgetClass))
    {

#ifdef HAVE_XFT
        if (instance->xft_data && instance->xft_data[0].xft_font)
        {
            set_text (&instance->xft_data[0], instance->parent,
                      val->contents->value, 10);
        }
#endif
        XtVaSetValues (widget, XtNlabel, val->contents->value, NULL);
    }
    else if (XtIsSubclass (widget, commandWidgetClass))
    {
        Dimension bw = 0;
        Arg al[10];
        int ac = 0;

        XtVaGetValues (widget, XtNborderWidth, &bw, NULL);
        if (bw == 0)
            /* Don't let buttons end up with 0 borderwidth, that's ugly...
               Yeah, all this should really be done through app-defaults files
               or fallback resources, but that's a whole different can of worms
               that I don't feel like opening right now.  Making Athena widgets
               not look like shit is just entirely too much work.
             */
        {
            XtSetArg (al[0], XtNborderWidth, 1);
            XtSetValues (widget, al, 1);
        }

        XtSetSensitive (widget, val->enabled);
        XtSetArg (al[ac], XtNlabel, val->value);
        ac++;
        /* Force centered button text.  Se above. */
        XtSetArg (al[ac], XtNjustify, XtJustifyCenter);
        ac++;
#ifdef HAVE_XFT
        if (instance->xft_data && instance->xft_data[0].xft_font)
        {
            int th;
            int nr;
            for (nr = 0; nr < instance->nr_xft_data; ++nr)
                if (instance->xft_data[nr].widget == widget)
                    break;
            if (nr < instance->nr_xft_data)
            {
                set_text (&instance->xft_data[nr], instance->parent,
                          val->value, 6);

                /* Must set internalHeight to twice the highlight thickness,
                   or else it gets overwritten by our pixmap.  Probably a bug.  */
                XtVaGetValues (widget, XtNhighlightThickness, &th, NULL);
                XtSetArg (al[ac], XtNinternalHeight, 2*th);
                ac++;
            }
        }
#endif
        XtSetValues (widget, al, ac);
        XtRemoveAllCallbacks (widget, XtNcallback);
        XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance);
    }
}
Exemplo n.º 18
0
static void Destroy (XtcwpAxesWidget w)
{
    XtRemoveAllCallbacks((Widget) w,XtNresizeCallback);
    XtRemoveAllCallbacks((Widget) w,XtNexposeCallback);
    XtRemoveAllCallbacks((Widget) w,XtNinputCallback);
}