Ejemplo n.º 1
0
PixmapGraphic::~PixmapGraphic()
{
  if (f_pixmap && (f_flag == NORMAL))
  {
    XFreePixmap (window_system().display(), f_pixmap);
    if (f_colors)
    {
      XFreeColors (window_system().display(), f_colormap,
                   f_colors, f_num_colors, 0 );
      XFree (f_colors);
#ifdef DEBUG
      printf( "pixmap %lx and its colors freed in PixmapGraphic %p\n",
               f_pixmap, this );
#endif
    }
    if (f_tiff_context)
    {
#ifdef DEBUG
      printf( "pixmap %lx and TIFF context %p freed in PixmapGraphic %p\n",
               f_pixmap, f_tiff_context, this );
#endif
      _DtGrDestroyContext(f_tiff_context);
      delete f_tiff_context ;	// free the struct memory we own
    }
  }
  assert(!f_agent);
}
Ejemplo n.º 2
0
ServiceMgr::ServiceMgr()
{
#if 0
  // We need to wait for the window to be mapped before doing anything
  XtAddEventHandler (window_system().toplevel(), StructureNotifyMask, False,
		     (XtEventHandler) handle_toplevel_mapped, this);
#endif
}
Ejemplo n.º 3
0
bool
PrefAgent::change_field (ChangeData *cd)
{
  // Get the current field value and add the change to it. 
  char *value = cd->field.Value();
  int amount = atoi (value);
  free (value);
  amount += cd->change;

  // reached the limit, need to make the arrow go insensitive
  if (amount == cd->limit)
  {
     // see if incrementing or decrementing
     if(cd->change < 0)
     {
       // user is decrementing--make down arrow insensitive
       XtSetSensitive(cd->dn_arrow, False);
     }
     else
     {
       // user is incrementing--make down arrow insensitive
       XtSetSensitive(cd->up_arrow, False);
     }
  }
  else
  {
     // see if incrementing or decrementing
     if(cd->change < 0)
     {
       // user is decrementing--make up arrow sensitive if it is
       // insensitive
       if(!XtIsSensitive(cd->up_arrow))
         XtSetSensitive(cd->up_arrow, True);
     }
     else
     {
       // user is incrementing--make down arrow sensitive if it is
       // insensitive
       if(!XtIsSensitive(cd->dn_arrow))
         XtSetSensitive(cd->dn_arrow, True);
     }
  }

  // Make sure the change won't exceed any limits.
  // If change is negative, then limit is a lower limit (and vice-versa).
  if ((cd->change < 0 && amount < cd->limit) ||
      (cd->change > 0 && amount > cd->limit))
    {
      // Sorry, Charlie. 
      window_system().beep();
      return (FALSE);
    }

  // Update the field to display the new value.
  set_integer (cd->field, amount);

  return (TRUE);
}
Ejemplo n.º 4
0
void 
StringPref::restore()
{
  // If no data, fetch default from resource db.
  if (*(UserPreference::value()) == '\0')
    f_value = strdup (window_system().get_string_default (key()));
  else
    f_value = strdup (UserPreference::value());
}
Ejemplo n.º 5
0
void
PrefAgent::arm_arrow (WCallback *wcb)
{
  // Add a timeout to keep changing the value.
  timeout_called = 0;
  f_timeout =
    new WTimeOut (window_system().app_context(), CHANGE_SPEED, this,
		  (WTimeOutFunc) &PrefAgent::change_timeout,
		  wcb->ClientData());
}
Ejemplo n.º 6
0
void 
WindowGeometryPref::restore()
{
  // If no data, fetch default from resource db.
  if (*(UserPreference::value()) == '\0')
    f_value = window_system().get_geometry_default (key());
  else
    sscanf (UserPreference::value(), "%dx%d+%d+%d",
	    &f_value.width, &f_value.height, &f_value.ulx, &f_value.uly);
}
Ejemplo n.º 7
0
void
InputMgrX::receive (WantInputReady &msg, void *client_data) {
    InputMgrData *newData = new InputMgrData;
    newData->fMsg = msg;
    newData->fObj = this;
    newData->fId = XtAppAddInput(window_system().app_context(), msg.fChannel, (XtPointer) XtInputReadMask,
                                 (XtInputCallbackProc) InputMgrX::inputHandler,
                                 (XtPointer) newData);
    fWantList.insert (newData);
    request(msg.fReceiver);
}
Ejemplo n.º 8
0
void
HelpAgent::Popup()
{
  Widget app_shell = window_system().toplevel();
  Widget parent = XtParent(f_helper);
  //XRaiseWindow(XtDisplay(parent), XtWindow(parent));
  UAS_List<UAS_String> env_infolibs(env().infolibs());
  library_mgr().init(env_infolibs);

  XMapRaised(XtDisplay(app_shell), XtWindow(app_shell));
  XMapRaised(XtDisplay(parent), XtWindow(parent));
}
Ejemplo n.º 9
0
void
PrefAgent::set_lock (bool set)
{
    if (set) {
	f_lock_toggle.WObject::Set(WArgList(XmNselectPixmap,
					    window_system().locked_pixmap(f_lock_toggle.Parent()),
					    XmNlabelPixmap,
					    window_system().semilocked_pixmap(f_lock_toggle.Parent()),
					    NULL));
    }
    else {
	f_lock_toggle.WObject::Set(WArgList(XmNselectPixmap,
					    window_system().semilocked_pixmap(f_lock_toggle.Parent()),
					    XmNlabelPixmap,
					    window_system().unlocked_pixmap(f_lock_toggle.Parent()),
					    NULL));
    }
    
    f_lock_toggle.Set (set);
    SET_VALUE (f_lock_toggle, Boolean, set);
}  
Ejemplo n.º 10
0
ServiceMgr::~ServiceMgr()
{
  // Need to stop being the OLIAS server if it's us.

  //  XGrabServer (window_system().display());

  Window current_server =
    XGetSelectionOwner (window_system().display(), _XA_OLIAS_WINDOW_ID);

  ON_DEBUG(printf ("Current OLIAS server is window 0x%lx\n", current_server));
  if (current_server == XtWindow (window_system().toplevel()))
    {
      ON_DEBUG(printf ("Done being the OLIAS server...\n"));
      ON_DEBUG(fflush (stdout));

      // OK to use CurrentTime because there is no chance of contention.
      XSetSelectionOwner (window_system().display(), _XA_OLIAS_WINDOW_ID,
			  None, CurrentTime);
    }
      
  //  XUngrabServer (window_system().display());
}
Ejemplo n.º 11
0
MapButton::MapButton (WComposite &parent,
                      const UAS_Pointer<UAS_Common> &doc_ptr,
		      MapButton *ancestor)
: f_form (parent, "form"),
  f_doc_ptr (doc_ptr),
  f_expanded (FALSE)
{
  ON_DEBUG (printf ("MapButton::MapButton (%s)\n", (char*)f_doc_ptr->title()));
  static bool expandable_tree =
    window_system().get_boolean_default ("ExpandableMap");
  UAS_List<UAS_Common> kids (f_doc_ptr->children());
  UAS_String t = f_doc_ptr->title();
  if (kids.length() > 0 && expandable_tree)
    {
      f_arrow = WXmArrowButton (f_form, "expand", WAutoManage);
      ON_ACTIVATE (f_arrow,expand);
      f_button =
	WXmPushButton (f_form, t, WAutoManage,
		       WArgList (XmNrightWidget, (XtArgVal) ((Widget) f_arrow),
				 XmNrightAttachment, XmATTACH_WIDGET,
				 NULL));
    }
  else
    {
      f_button = WXmPushButton (f_form, t, WAutoManage);
    }

  ON_ACTIVATE (f_button,activate);
  SET_CALLBACK (f_form,Destroy,destroy);

  f_form.ShadowThickness (0);
  // f_form.Realize();

  // Add to the list so that we can manage 'em all at once. 
  if (f_num_kids + 1 > f_kids_size)
    {
      f_kids_size *= 2;
      f_kids = (Widget *) realloc (f_kids, sizeof (Widget) * f_kids_size);
    }
  f_kids[f_num_kids++] = (Widget) f_form;
  ON_DEBUG (printf ("Form managed = %d\n", XtIsManaged (f_form)));
    
  if (ancestor != NULL)
    {
      CXawTree form (f_form);
      WArgList args;

      form.TreeParent (ancestor->f_form, args);
      form.Set (args.Args(), args.NumArgs());
    }
}
Ejemplo n.º 12
0
void
HelpAgent::create_ui()
{
  Arg args[2];
  int n;
  Widget app_shell = window_system().toplevel();
  f_appXrmDb = XrmGetDatabase (XtDisplay (app_shell));

  n = 0;
  XtSetArg(args[n], XmNtitle, "Dtinfo Help"); n++;
  f_helper = DtCreateHelpDialog(app_shell,
                                "helpdialog",
                                args, n);
}
Ejemplo n.º 13
0
void 
IntegerPref::restore()
{
  ON_DEBUG (printf ("Getting Integer <%s>\n", key()));
  // If no data, fetch default from resource db.
  if (*(UserPreference::value()) == '\0')
    {
      ON_DEBUG (puts ("  Getting from X Resource"));
      f_value = window_system().get_int_default (key());
    }
  else
    {
      ON_DEBUG (puts ("  Getting from preferences"));
      sscanf (UserPreference::value(), "%d", &f_value);
    }
}
Ejemplo n.º 14
0
void
ServiceMgr::establish_server()
{
  create_atoms();

  // Operations in this routine must be atomic to avoid race conditions,
  // hence the server grab.

  XGrabServer (window_system().display());

  Window current_server =
    XGetSelectionOwner (window_system().display(), _XA_OLIAS_WINDOW_ID);

  ON_DEBUG(printf ("Current OLIAS server is window 0x%lx\n", current_server));

  // If no current server, we'll become the server.
  if (current_server == None)
    {
      ON_DEBUG(printf ("Attempting to become OLIAS server..."));
      ON_DEBUG(fflush (stdout));
      current_server = XtWindow (window_system().toplevel());

      // OK to use CurrentTime because there is no chance of contention.
      XSetSelectionOwner (window_system().display(), _XA_OLIAS_WINDOW_ID,
			  current_server, CurrentTime);

      // Make sure it worked.
      current_server = XGetSelectionOwner (window_system().display(),
					   _XA_OLIAS_WINDOW_ID);

      if (current_server == XtWindow (window_system().toplevel()))
	{
	  client_event_manager().register_handler(this, window_system().toplevel());
	  ON_DEBUG(puts ("successful!"));
	}
      else
	{
	  ON_DEBUG(puts ("failed!"));
	}
    }

  XUngrabServer (window_system().display());
}
Ejemplo n.º 15
0
void
ServiceMgr::get_olias_event (XEvent *event)
{
  // Make sure it's the right event first. 
  if (event->type != ClientMessage ||
      event->xclient.message_type != _XA_OLIAS_EVENT)
    return;

  Atom selection = event->xclient.data.l[2];
  Time time      = event->xclient.data.l[3];

  /* -------- Ask for the client the event from the client. -------- */
  ON_DEBUG(puts ("OLIAS: Received a client display event!"));

  XtGetSelectionValue (window_system().toplevel(), selection,
		       _XA_OLIAS_EVENT,
		       (XtSelectionCallbackProc) receive_olias_event,
		       this, time);		       
}
Ejemplo n.º 16
0
void
PrefAgent::change_timeout (WTimeOut *wto)
{
  timeout_called++;
  // Change the value.
  bool changed = change_field ((ChangeData *) wto->ClientData());
  // Add the callback again if the limit hasn't been reached. 
  if (changed)
    {
      int speed = CHANGE_SPEED;
      // After three times double the speed. 
      if (timeout_called > 3)
	speed /= 2;
      f_timeout =
	new WTimeOut (window_system().app_context(), speed, this,
		      (WTimeOutFunc) &PrefAgent::change_timeout,
		      wto->ClientData());
    }
  else
    f_timeout = NULL;
}
Ejemplo n.º 17
0
void
ServiceMgr::create_atoms()
{
  static Boolean created = False;

  if (!created)
    {
      enum { XA_OLIAS_WINDOW_ID_ATOM, XA_OLIAS_EVENT_ATOM,
	     XA_OLIAS_REPLY_ATOM, NUM_ATOMS }; 
      static const char *atom_names[] = { OLIAS_WINDOW_ID_ATOM,
	     OLIAS_EVENT_ATOM, OLIAS_REPLY_ATOM };

      Atom atoms[XtNumber(atom_names)];

      XInternAtoms (window_system().display(), (char**)atom_names,
		    XtNumber((char**)atom_names), False, atoms);

      _XA_OLIAS_WINDOW_ID = atoms[XA_OLIAS_WINDOW_ID_ATOM];
      _XA_OLIAS_EVENT = atoms[XA_OLIAS_EVENT_ATOM];
      _XA_OLIAS_REPLY = atoms[XA_OLIAS_REPLY_ATOM];

      created = True;
    }
}
Ejemplo n.º 18
0
void
PrefAgent::create_ui()
{
  // Create main preferences window.

  XmStringLocalized mtfstring;
  String	    string;
  int		    decorations=MWM_DECOR_BORDER  |
                                MWM_DECOR_RESIZEH |
                                MWM_DECOR_TITLE   |
                                MWM_DECOR_MENU;

  f_shell = WTopLevelShell (window_system().toplevel(), WPopup, "preferences");
  window_system().register_shell(&f_shell);

  string = CATGETS(Set_PrefAgent, 1, "Dtinfo: Preferences");
  XtVaSetValues((Widget)f_shell,
                XmNtitle, string,
                XmNmwmDecorations, decorations,
                NULL);

  DECL  (WXmForm,         form,         f_shell,      "form");
  DECLMC(WXmOptionMenu,   options,      form,         "options");
  DECLC (WXmPulldownMenu, options_menu, form,         "options_menu");

  mtfstring = CATGETS(Set_AgentLabel, 186, "Preferences for");
  XtVaSetValues(options, XmNlabelString, (XmString)mtfstring, NULL);

  ASSNM (WXmPushButton,   f_ok,         form,         "ok");
  ASSNM (WXmPushButton,   f_apply,      form,         "apply");
  ASSNM (WXmPushButton,   f_reset,      form,         "reset");
  DECLM (WXmPushButton,   cancel,       form,         "cancel");
  DECLM (WXmPushButton,   help,         form,         "help");

  mtfstring = CATGETS(Set_AgentLabel, 161, "OK");
  XtVaSetValues(f_ok, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 201, "Apply");
  XtVaSetValues(f_apply, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 202, "Reset");
  XtVaSetValues(f_reset, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 162, "Cancel");
  XtVaSetValues(cancel, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 48, "Help");
  XtVaSetValues(help, XmNlabelString, (XmString)mtfstring, NULL);

  SET_CALLBACK (f_ok,Activate,ok);
  SET_CALLBACK (f_apply,Activate,apply);
  SET_CALLBACK (f_reset,Activate,reset);
  SET_CALLBACK (cancel,Activate,cancel);
  help_agent().add_activate_help (help, (char*)"preferences_help");

  DECLM (WXmFrame,        frame,        form,         "frame");
  DECL  (WXmForm,         container,    frame,        "container");

  // Create browsing preferences.
  DECLM (WXmPushButton,   browse,          options_menu,  "browse");

  DECL  (WXmForm,         browse_form,     container,     "browse_prefs");
  DECLM (WXmLabel,        browse_label,    browse_form,   "browse_label");
  DECLM (WXmPushButton,   get_browse_geo,  browse_form,   "get_browse_geo");
  ASSNM (WXmTextField,    f_browse_geo,    browse_form,   "browse_geo");
  DECLM (WXmLabel,        fs_label,        browse_form,   "fs_label");
  DECL  (WXmForm,         fs_form,         browse_form,   "fs_form");
  ASSNM (WXmTextField,    f_fs_field,      fs_form,       "scale_field");
  DECLM (WXmArrowButton,  scale_up,        fs_form,       "scale_up");
  DECLM (WXmArrowButton,  scale_down,      fs_form,       "scale_down");
  DECLM (WXmLabel,        lock_label,      browse_form,   "lock_label");
  ASSNM (WXmToggleButton, f_lock_toggle,   browse_form,   "lock_toggle");

  mtfstring = CATGETS(Set_AgentLabel, 187, "Browsing");
  XtVaSetValues(browse, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 190, "Browser Geometry");
  XtVaSetValues(browse_label, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 270, "...");
  XtVaSetValues(get_browse_geo, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 192, "Font Scale");
  XtVaSetValues(fs_label, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 193, "Pin Window");
  XtVaSetValues(lock_label, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 194, "File a Bug");
  XtVaSetValues(f_lock_toggle, XmNlabelString, (XmString)mtfstring, NULL);

  Dimension height;
  ChangeData *inc, *dec;

  // Assume that the fields are taller than the labels.  If the user
  // changes the font resources and violates this assumtion he's screwed
  // and that's the way we like it.

  height = f_fs_field.Height();

  browse_label.Height (height);
  fs_label.Height (height);
  scale_up.Height (height/2);
  scale_down.Height (height/2);

  f_lock_toggle.LabelType (XmPIXMAP);
  lock_label.Height (height);

  fs_form.Manage();
  browse_form.Manage();
  f_top_panel = browse_form;

  SET_CALLBACK_D (browse,Activate,switch_to_window,(Widget)browse_form);
  SET_CALLBACK_D (get_browse_geo,Activate,get_geometry,(Widget)f_browse_geo);
  SET_CALLBACK (f_browse_geo,ValueChanged,something_changed);
  SET_CALLBACK (f_fs_field,ValueChanged,something_changed);
  SET_CALLBACK (f_lock_toggle,ValueChanged,something_changed);
  SET_CALLBACK (f_lock_toggle,ValueChanged,lock_toggle);

  inc = new ChangeData(f_fs_field, scale_up, scale_down, 1, 5);
  dec = new ChangeData(f_fs_field, scale_up, scale_down, -1, -2);
  SET_CALLBACK_D (scale_up,Activate,change_cb,inc);
  SET_CALLBACK_D (scale_up,Arm,arm_arrow,inc);
  SET_CALLBACK  (scale_up,Disarm,disarm_arrow);
  SET_CALLBACK_D (scale_down,Activate,change_cb,dec);
  SET_CALLBACK_D (scale_down,Arm,arm_arrow,dec);
  SET_CALLBACK  (scale_down,Disarm,disarm_arrow);

  // Create map window preferences
  DECLM (WXmPushButton,   map,             options_menu,  "map");
  DECLM (WXmForm,         map_form,        container,     "map_prefs");
  DECLM (WXmLabel,        map_label,       map_form,      "map_label");
  DECLM (WXmPushButton,   get_map_geo,     map_form,      "get_map_geo");
  ASSNM (WXmTextField,    f_map_geo,       map_form,      "map_geo");
  DECLM (WXmLabel,        update_label,    map_form,      "update_label");
  ASSNM (WXmToggleButton, f_update_toggle, map_form,      "update_toggle");

  mtfstring = CATGETS(Set_AgentLabel, 188, "Map");
  XtVaSetValues(map, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 195, "Map Geometry");
  XtVaSetValues(map_label, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 270, "...");
  XtVaSetValues(get_map_geo, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 196, "Auto Update");
  XtVaSetValues(update_label, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 194, "File a Bug");
  XtVaSetValues(f_update_toggle, XmNlabelString, (XmString)mtfstring, NULL);

  height = f_map_geo.Height();
  map_label.Height (height);
  update_label.Height (height);
  
  SET_CALLBACK_D (get_map_geo,Activate,get_geometry,(Widget)f_map_geo);
  SET_CALLBACK_D (map,Activate,switch_to_window,(Widget)map_form);
  SET_CALLBACK (f_map_geo,ValueChanged,something_changed);
  SET_CALLBACK (f_update_toggle,ValueChanged,something_changed);
  SET_CALLBACK (f_update_toggle,ValueChanged,update_toggle);

  map_form.Manage();

  // Create history preferences 
  DECLM (WXmPushButton,   history,      options_menu, "history");

  mtfstring = CATGETS(Set_AgentLabel, 260, "History");
  XtVaSetValues(history, XmNlabelString, (XmString)mtfstring, NULL);

  DECL  (WXmForm,         hist_form,     container,     "history_prefs");
  DECLM (WXmLabel,        nh_label,      hist_form,     "nh_label");
  DECL  (WXmForm,         nh_form,       hist_form,     "nh_form");
  ASSNM (WXmTextField,    f_nh_field,    nh_form,       "nh_field");
  DECLM (WXmArrowButton,  nh_up,         nh_form,       "nh_up");
  DECLM (WXmArrowButton,  nh_down,       nh_form,       "nh_down");
  DECLM (WXmLabel,        sh_label,      hist_form,     "sh_label");
  DECL  (WXmForm,         sh_form,       hist_form,     "sh_form");
  ASSNM (WXmTextField,    f_sh_field,    sh_form,       "sh_field");
  DECLM (WXmArrowButton,  sh_up,         sh_form,       "sh_up");
  DECLM (WXmArrowButton,  sh_down,       sh_form,       "sh_down");

  mtfstring = CATGETS(Set_AgentLabel, 197, "Section History Size");
  XtVaSetValues(nh_label, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 198, "Search History Size");
  XtVaSetValues(sh_label, XmNlabelString, (XmString)mtfstring, NULL);

  height = f_nh_field.Height();
  nh_label.Height (height);
  nh_up.Height (height/2);
  nh_down.Height (height/2);

  height = f_sh_field.Height();
  sh_label.Height (height);
  sh_up.Height (height/2);
  sh_down.Height (height/2);

  nh_form.Manage();
  sh_form.Manage();
  hist_form.Manage();
  
  SET_CALLBACK_D (history,Activate,switch_to_window,(Widget)hist_form);
  SET_CALLBACK (f_nh_field,ValueChanged,something_changed);
  SET_CALLBACK (f_sh_field,ValueChanged,something_changed);

  inc = new ChangeData (f_nh_field, nh_up, nh_down, 10, 1000);
  dec = new ChangeData (f_nh_field, nh_up, nh_down, -10, 10);
  SET_CALLBACK_D (nh_up,Activate,change_cb,inc);
  SET_CALLBACK_D (nh_up,Arm,arm_arrow,inc);
  SET_CALLBACK (nh_up,Disarm,disarm_arrow);
  SET_CALLBACK_D (nh_down,Activate,change_cb,dec);
  SET_CALLBACK_D (nh_down,Arm,arm_arrow,dec);
  SET_CALLBACK (nh_down,Disarm,disarm_arrow);

  inc = new ChangeData (f_sh_field, sh_up, sh_down, 10, 1000);
  dec = new ChangeData (f_sh_field, sh_up, sh_down, -10, 10);
  SET_CALLBACK_D (sh_up,Activate,change_cb,inc);
  SET_CALLBACK_D (sh_up,Arm,arm_arrow,inc);
  SET_CALLBACK (sh_up,Disarm,disarm_arrow);
  SET_CALLBACK_D (sh_down,Activate,change_cb,dec);
  SET_CALLBACK_D (sh_down,Arm,arm_arrow,dec);
  SET_CALLBACK (sh_down,Disarm,disarm_arrow);

  // Create Search preferences.

  DECLM (WXmPushButton,   search,            options_menu,  "search");

  mtfstring = CATGETS(Set_AgentLabel, 189, "Searching");
  XtVaSetValues(search, XmNlabelString, (XmString)mtfstring, NULL);

  DECL  (WXmForm,         search_form,       container,     "search_prefs");
  DECLM (WXmLabel,        max_hits_label,    search_form,   "max_hits");
  DECL  (WXmForm,         hits_form,         search_form,   "hits_form");
  ASSNM (WXmTextField,    f_max_hits_field,  hits_form,     "hits_field");
  DECLM (WXmArrowButton,  hits_up,           hits_form,     "hits_up");
  DECLM (WXmArrowButton,  hits_down,         hits_form,     "hits_down");
  DECLM (WXmLabel,        adisplay_label,    search_form,   "adisplay_label");
  ASSNM (WXmToggleButton, f_adisplay_toggle, search_form,   "adisplay_toggle");

  mtfstring = CATGETS(Set_AgentLabel, 199, "Maximum Search Hits");
  XtVaSetValues(max_hits_label, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 200, "Auto Display First Hit");
  XtVaSetValues(adisplay_label, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring = CATGETS(Set_AgentLabel, 194, "File a Bug");
  XtVaSetValues(f_adisplay_toggle, XmNlabelString, (XmString)mtfstring, NULL);

  height = f_max_hits_field.Height();
  max_hits_label.Height (height);
  hits_up.Height (height/2);
  hits_down.Height (height/2);
  adisplay_label.Height (height);

  hits_form.Manage();
  search_form.Manage();

  SET_CALLBACK_D (search,Activate,switch_to_window,(Widget)search_form);
  SET_CALLBACK (f_max_hits_field,ValueChanged,something_changed);

  inc = new ChangeData (f_max_hits_field, hits_up, hits_down, 10, 500);
  dec = new ChangeData (f_max_hits_field, hits_up, hits_down, -10, 10);
  SET_CALLBACK_D (hits_up,Activate,change_cb,inc);
  SET_CALLBACK_D (hits_up,Arm,arm_arrow,inc);
  SET_CALLBACK (hits_up,Disarm,disarm_arrow);
  SET_CALLBACK_D (hits_down,Activate,change_cb,dec);
  SET_CALLBACK_D (hits_down,Arm,arm_arrow,dec);
  SET_CALLBACK (hits_down,Disarm,disarm_arrow);
  SET_CALLBACK (f_adisplay_toggle,ValueChanged,something_changed);
  SET_CALLBACK (f_adisplay_toggle,ValueChanged,adisplay_toggle);

  /* -------- node history size, search history size -------- */

  options.SubMenuId (options_menu);

  container.Manage();
  form.DefaultButton (f_ok);
  form.ShadowThickness (0);
  form.Manage();

  f_shell.Realize();
  Dimension width;
  f_shell.Get (WArgList (XmNheight, (XtArgVal) &height,
			 XmNwidth, &width,
			 NULL));
  f_shell.Set (WArgList (XmNminHeight, height,
			 XmNmaxHeight, height,
			 XmNminWidth,  width,
			 XmNmaxWidth,  width,
			 NULL));

  map_form.Unmanage();
  hist_form.Unmanage();
  search_form.Unmanage();

  // Values get displayed when reset() is called on dialog display. 
  init_values();
}
Ejemplo n.º 19
0
XmString
SearchHistoryListView::display_value(FolioObject *object)
{
  ResultID &rid = *(ResultID*)object;

  char buf[8];
  sprintf(buf, "%d", rid.ndocs());
  WXmString matchString = buf;

  UAS_Pointer<UAS_SearchResults> results = rid.results();  
  WXmString scopeString = (char*)*results->scope_name();

  WXmString queryString = rid.display_as();

  XmFontList fontlist = f_list->FontList();

  int number_width = WXmString("0").Width(fontlist) ;

  WXmString matchPostfix(
	window_system().make_space(
		8 * number_width - matchString.Width(fontlist),
		*f_list
	),
	False);

  int scope_field_width = 22 * number_width;

  int allowance;

  if ((allowance = scope_field_width - scopeString.Width(fontlist)) < 0)
  {
    char* dots = "...";

    // need to free ungenerated at the end
    char* ungenerated = (char*)(scopeString + WXmString(dots));

    wchar_t* buf = WString(ungenerated);
    wchar_t* ptr = buf + wcslen(buf) - (strlen(dots)+1);

    XtFree(ungenerated);

    WXmString stake;
    WString wdots(dots);

    do
    {
      char* str;
      memcpy(ptr--, (wchar_t*)wdots, (strlen(dots)+1) * sizeof(wchar_t));

      stake = str = WString(buf).get_mbstr();
      allowance = scope_field_width - stake.Width(fontlist);

      delete[] str;
    }
    while (allowance <= 0 && ptr >= buf);

    while (*ptr <= (wchar_t)' ' && ptr >= buf)
    {
      char* str;
      memcpy(ptr--, (wchar_t*)wdots, (strlen(dots)+1) * sizeof(wchar_t));

      stake = str = WString(buf).get_mbstr();
      allowance = scope_field_width - stake.Width(fontlist);

      delete[] str;
    }

    scopeString = stake;
  }

  WXmString scopePostfix(
	window_system().make_space(allowance, *f_list), False);

  WXmString entry_string = matchString + matchPostfix +
			   scopeString + scopePostfix +
			   queryString;

  return entry_string.disown();
}
Ejemplo n.º 20
0
HelpAgent::HelpAgent()
: f_helper (NULL)
{
  Widget app_shell = window_system().toplevel();
  f_cursor = create_help_cursor(app_shell);
}
Ejemplo n.º 21
0
void
ListView::create_ui_objects()
{
  /* -------- Create ui components. -------- */
  f_shell = new WTopLevelShell (toplevel(), WPopup, f_name);
  window_system().register_shell (f_shell);
  WXmForm form (*f_shell, "form");

  /* -------- allow child to be creative -------- */
  child_create_ui_pre(form);


  WXmPushButton close (form, "close", WAutoManage);
  WXmPushButton help (form, "help", WAutoManage);

  XtVaSetValues(close, XmNlabelString,
	(XmString)XmStringLocalized(CATGETS(Set_AgentLabel, 12, "Close")), NULL);
  XtVaSetValues(help, XmNlabelString,
	(XmString)XmStringLocalized(CATGETS(Set_AgentLabel, 48, "Help")), NULL);

  // 7/30/93 rtp - bear with this hack, it's a little bogus
  char *help_name = new char[strlen(f_name) + strlen("_help") + 1];
  sprintf(help_name, "%s%s", f_name, "_help");
  // What i've done is appended '_help' to the widget name and added
  // a help callback to the help button that will reference this name
  help_agent().add_activate_help (help, help_name);

  f_activate = WXmPushButton (form, "activate", WAutoManage);
  XtVaSetValues(f_activate, XmNlabelString,
	(XmString)XmStringLocalized(CATGETS(Set_AgentLabel, 165, "Display")), NULL);
  //  WXmLabelGadget label (form, "label", WAutoManage);
  WXmSeparator separator (form, "separator", WAutoManage);
  // NOTE: Fix WWL to have a scrolled list object!
  Widget scrolled_list = XmCreateScrolledList (form, "list", NULL, 0);
  f_list = new WXmList (scrolled_list);
  f_list->Manage();

  XmFontList defaultList;
  {
    XmFontList font;
    XtVaGetValues(scrolled_list, XmNfontList, &font, NULL);
    defaultList = XmFontListCopy(font);
  }
  if (window_system().dtinfo_space_font())
    defaultList = XmFontListAppendEntry(defaultList,
                                        window_system().dtinfo_space_font());
  XtVaSetValues(scrolled_list, XmNfontList, defaultList, NULL);

  /* -------- let child add anything else -------- */
  child_create_ui_post(form);

  /* -------- Callbacks -------- */
  f_wm_delete_callback =
    new WCallback (*f_shell, window_system().WM_DELETE_WINDOW(),
		   this, (WWL_FUN) &ListView::close_window);
  close.SetActivateCallback (this, (WWL_FUN) &ListView::close_window);
  f_list->SetSingleSelectionCallback (this, (WWL_FUN) &ListView::select);
  f_list->SetBrowseSelectionCallback (this, (WWL_FUN) &ListView::select);
  f_list->SetDefaultActionCallback (this, (WWL_FUN) &ListView::activate);
  f_activate.SetActivateCallback (this, (WWL_FUN) &ListView::activate);

  /* -------- Finalize -------- */
  form.DefaultButton (f_activate);
  form.ShadowThickness (0);  // get rid of border turds (motif bug)
  form.Manage();
}
Ejemplo n.º 22
0
void
MapAgent::display (UAS_Pointer<UAS_Common> &doc_ptr, bool popup)
{
  static bool first_time = True;
  u_int i, num_children;
  MapButton *parent_button, *child_button, *this_button = NULL;

  if (f_shell == NULL)
    create_ui();

  // Just pop up the window if the map has already been created
  // for the specified document.
  if (doc_ptr == f_doc_ptr)
    {
      if (popup) {
	f_shell->Popup();
        XMapRaised(XtDisplay(*f_shell), XtWindow(*f_shell));
      }
      f_onscreen = TRUE;
      return;
    }

  // Must have to create a new tree, so start by wiping out the old one. 
  if (f_tree != NULL)
    {
      f_tree->Destroy();
      delete f_tree;
    }
  f_tree = new WXawTree (*f_porthole, "tree");
  //  f_tree->Realize();

  // Tree gravity should be a preference that is retrieved right here.
  // (Or better yet stored in the class record.) 

  /* -------- Start the local map at this node's parent. -------- */

  UAS_Pointer<UAS_Common> toc_this = doc_ptr;
  UAS_Pointer<UAS_Common> toc_parent =
      (doc_ptr != (UAS_Pointer<UAS_Common>)0)
	  ? doc_ptr->parent() : (UAS_Pointer<UAS_Common>)0;

  // If the entry has a parent, create a button for it and each of
  // the entry's siblings. 
  if (toc_parent != (UAS_Pointer<UAS_Common>)NULL)
    {
      parent_button = new MapButton (*f_tree, toc_parent, NULL);
      //  parent_button->expand();

      /* -------- Create a button for each sibling. -------- */

      UAS_List<UAS_Common> kids = toc_parent->children();
      num_children = kids.length();
      UAS_Pointer<UAS_Common> toc_kid;
      for (i = 0; i < num_children; i++)
	{
	  toc_kid = kids[i];
	  child_button = new MapButton (*f_tree, toc_kid, parent_button);
	  if (toc_kid == doc_ptr)
            {
              f_doc_ptr = doc_ptr;
   	      this_button = child_button;
            }
	}
    }
  else // No TOC parent -- SWM: Also may be no TOC!!!
    {
      f_doc_ptr = doc_ptr;
      this_button = new MapButton (*f_tree, toc_this, NULL);
    }

  if (this_button == NULL)
    {
      message_mgr().
	error_dialog (CATGETS(Set_Messages, 7, "File a Bug"));
      return;
    }
  else
    {
      static bool first_time = TRUE;
      static Pixel highlight_bg, highlight_fg;
      if (first_time)
	{
	  const char *s;
	  unsigned long status;
	  s = window_system().get_string_default ("MapHighlightBackground");
	  if (s == NULL || *s == '\0')
	    {
	      highlight_bg = this_button->f_button.Foreground();
	    }
	  else
	    {
	      status = window_system().get_color (s, highlight_bg);
	      // On failure to allocate, just invert. 
	      if (status == 0)
		{
		  highlight_bg = this_button->f_button.Foreground();
		  highlight_fg = this_button->f_button.Background();
		}
	      // Got bg, so now try for fg. 
	      else
		{
	          s = window_system().
		        get_string_default ("MapHighlightForeground");
		  if (s == NULL || *s == '\0')
		    {
		      highlight_fg =this_button->f_button.Background();
		    }
		  else
		    {
		      status = window_system().get_color (s, highlight_fg);
		      // If we cant get both colors, just invert the button. 
		      if (status == 0)
			{
			  Display *dpy = window_system().display();
			  XFreeColors (dpy,
				       DefaultColormap(dpy,DefaultScreen(dpy)),
				       &highlight_bg, 1, 0);
			  highlight_bg = this_button->f_button.Foreground();
			  highlight_fg = this_button->f_button.Background();
			}
		    }
		}
	    }
	  if (highlight_fg == this_button->f_button.Foreground() ||
	      highlight_bg == this_button->f_button.Background() ||
	      highlight_fg == highlight_bg)
	    {
	      highlight_bg = this_button->f_button.Foreground();
	      highlight_fg = this_button->f_button.Background();
	    }
	  first_time = FALSE;
	}
      this_button->f_button.Background (highlight_bg);
      this_button->f_button.Foreground (highlight_fg);
      //  this_button->expand();
    }

  /* -------- Create a button for each child. -------- */

  if (toc_this != (UAS_Pointer<UAS_Common>)NULL)
    {
      UAS_List<UAS_Common> myKids = toc_this->children();
      num_children = myKids.length();
      for (i = 0; i < num_children; i++)
	child_button =
	  new MapButton (*f_tree, myKids[i], this_button);

#if 0
  if (!XtIsRealized(*f_shell))
    {
      f_tree->Manage();
      f_shell->Realize();
    }
#endif

    }
  // Manage all the children.
  MapButton::ManageKids();

  UAS_String buffer = CATGETS(Set_MapAgent, 2, "Dtinfo: ");
  buffer = buffer + doc_ptr->title();
  f_shell->Title ((char*)buffer);

  if (!XtIsRealized (*f_shell))
    f_shell->Realize();

  f_tree->Realize();
  f_tree->ForceLayout();

  f_min_tree_width = f_tree->Width();
  f_min_tree_height = f_tree->Height();
  ON_DEBUG (printf ("+++++ Tree min dims: %d x %d\n",
		    f_min_tree_width, f_min_tree_height));

  center_on (this_button);
  f_tree->Manage();

  if (popup)
    {
      if (first_time)
	{
  	  WXmForm form (XtParent (XtParent (*f_panner)));
	  form.Height (50);
	  first_time = False;
	}
      f_shell->Popup();
      XMapRaised(XtDisplay(*f_shell), XtWindow(*f_shell));
    }

  f_onscreen = TRUE;
}
Ejemplo n.º 23
0
void
SearchHistoryListView::child_create_ui_pre(WXmForm &form)
{
  Widget header = WXmLabel(form, "header", WAutoManage);

  XmFontList header_font;
  {
    XmFontList font;
    XtVaGetValues(header, XmNfontList, &font, NULL);
    header_font = XmFontListCopy(font);
  }

  if (window_system().dtinfo_space_font())
    header_font = XmFontListAppendEntry(header_font,
                                        window_system().dtinfo_space_font());

  XtVaSetValues(header, XmNfontList, header_font, NULL);

#ifdef FONT_DEBUG
  XmFontContext font_context;

  if (XmFontListInitFontContext(&font_context, header_font))
  {

    XmFontListEntry fle = NULL;
    do
    {
      if (fle = XmFontListNextEntry(font_context)) {
	char* tag = XmFontListEntryGetTag(fle);
	if (tag)
	  fprintf(stderr, "(DEBUG) tag=%s\n", tag);
      }
    }
    while (fle);
  
    XmFontListFreeFontContext(font_context);
  }
#endif

  int number_width = WXmString("0").Width(header_font);

  WXmString matchString = CATGETS(Set_AgentLabel, 246, "Matches");
  WXmString scopeString = CATGETS(Set_AgentLabel, 243, "Scope");
  WXmString queryString = CATGETS(Set_AgentLabel, 230, "Query");

  int scope_offset = 8 * number_width;

  if (matchString.Width(header_font) >= scope_offset)
  {
    char* dots = "...";

    char* ungenerated = (char*)(matchString + WXmString(dots));

    WString anonym_wstring = ungenerated; // important for digital compiler!
    wchar_t* buf = (wchar_t*)anonym_wstring;
    wchar_t* ptr = buf + wcslen(buf) - (strlen(dots)+1);

    XtFree(ungenerated);

    WXmString stake;
    WString wdots(dots);    

    int allowance;
    do
    {
      char* str;
      memcpy(ptr--, (wchar_t*)wdots, (strlen(dots)+1) * sizeof(wchar_t));

      stake = str = WString(buf).get_mbstr();
      
      allowance = scope_offset - stake.Width(header_font);

      delete[] str;
    }
    while (allowance <= 0 && ptr >= buf);

    while (*ptr <= (wchar_t)' ' && ptr >= buf)
    {
      char* str;
      memcpy(ptr--, (wchar_t*)wdots, (strlen(dots)+1) * sizeof(wchar_t));

      stake = str = WString(buf).get_mbstr();
      allowance = scope_offset - stake.Width(header_font);

      delete[] str;
    }
    
    matchString = stake;
  }

  WXmString matchPostfix(
	window_system().make_space(
		scope_offset - matchString.Width(header_font),
		header
	),
	False);
  WXmString scopePostfix(
	window_system().make_space(
		22 * number_width - scopeString.Width(header_font),
		header
	),
	False);
	
  WXmString header_string = matchString + matchPostfix +
			    scopeString + scopePostfix +
			    queryString;
			
  XtVaSetValues(header, XmNlabelString, (XmString)header_string, NULL);

}
Ejemplo n.º 24
0
void
PrefAgent::get_geometry (WCallback *wcb)
{
  WXmTextField text_field ((Widget)wcb->ClientData());
  char *shell_name = NULL;
  if (text_field == f_map_geo)
    shell_name = (char*)"map";
  else if (text_field == f_browse_geo)
    shell_name = (char*)"nodeview";
    
  // Display an instructional dialog. 
  WXmMessageDialog
    info_dialog ((Widget)f_shell, (char*)"geometry_msg",
		 WArgList (XmNdialogType, XmDIALOG_INFORMATION, NULL));
  WXmDialogShell shell (info_dialog.Parent());
  // set window title
  String string = CATGETS(Set_PrefAgent, 2, "Dtinfo: Get Geometry");
  XtVaSetValues((Widget)shell, XmNtitle, string, NULL);
  //  window_system().register_full_modal_shell (&shell);
  info_dialog.MessageString (
	(char*)UAS_String(CATGETS(Set_Messages, 16, "File a Bug")));
  XtUnmanageChild (info_dialog.OkPB());
  XtUnmanageChild (info_dialog.HelpPB());

  XtVaSetValues((Widget)info_dialog, XmNdefaultPosition, False, NULL);

  // Wait for the dialog to appear. 
  int mapped = FALSE;
  info_dialog.Manage();
  XtAddEventHandler (info_dialog, ExposureMask, False,
		     dialog_mapped, (XtPointer) &mapped);
  XtAppContext app_context = window_system().app_context();
  XEvent event;
  while (!mapped)
    {
      XtAppNextEvent (app_context, &event);
      XtDispatchEvent (&event);
    }

  // Let the user pick an OLIAS window. 
  static Cursor pick_cursor =
    XCreateFontCursor (window_system().display(), XC_crosshair);
  Widget target;
  target = XmTrackingEvent (f_shell, pick_cursor, False, &event);

  // Get the geometry of the selected window.
  while (target != NULL && !XtIsShell (target))
    target = XtParent (target);

  if (target != (Widget) info_dialog.Parent())
    {
      // Make sure the user clicked on the right kind of window.
      if (target != NULL && strcmp (XtName(target), shell_name) != 0)
	target = NULL;

      if (target == NULL)
	{
	  XBell (window_system().display(), 100);
	}
      else
	{
	  WShell shell (target);
	  WindowGeometry wg;
	  wg.width = shell.Width();
	  wg.height = shell.Height();
	  set_geometry (text_field, wg);
	}
    }

  // Nuke the dialog.
  info_dialog.Unmanage();
  XtDestroyWidget (info_dialog.Parent());
}
Ejemplo n.º 25
0
void
MapAgent::create_ui()
{
  MapButton::f_kids_size = 8;
  MapButton::f_kids = (Widget *)
                      malloc (sizeof (Widget) * MapButton::f_kids_size);
  
  f_shell = new WTopLevelShell (toplevel(), WPopup, "map");
  window_system().register_shell (f_shell);

  XtVaSetValues(*f_shell, XmNtitle,
	        CATGETS(Set_MapAgent, 1, "Dtinfo: Local Map"), NULL);
  WindowGeometry wg = pref_mgr().get_geometry (PrefMgr::MapGeometry);
  f_shell->Set(WArgList(XmNwidth, wg.width,
			XmNheight, wg.height,
			NULL));

  // rtp - added new code 8/27/92
  WXmForm rootform (*f_shell, "rootform");

  WXmForm bottomform (rootform, "bottomform");
  WXmPushButton close (bottomform, "close", WAutoManage);
  WXmPushButton help (bottomform, "help", WAutoManage);
  help_agent().add_activate_help (help, (char*)"map_help");

  XtVaSetValues(close, XmNlabelString,
	(XmString)XmStringLocalized(CATGETS(Set_AgentLabel, 12, "Close")), NULL);
  XtVaSetValues(help, XmNlabelString,
	(XmString)XmStringLocalized(CATGETS(Set_AgentLabel, 48, "Help")), NULL);

  WXmPanedWindow pane (rootform, "pane");
  WXmForm topform (pane, "topform");
  XtVaSetValues(topform, XmNheight, 75, NULL);
  XtVaSetValues(pane, XmNpaneMinimum, 75, XmNpositionIndex, 1, NULL);

  WXmFrame panner_frame (topform, "pframe", WAutoManage);
  f_panner = new WXawPanner (panner_frame, "panner", WAutoManage);
  WXmFrame tree_frame (pane, "tframe", WAutoManage);
  f_porthole = new WXawPorthole (tree_frame, "porthole");

  f_lock = new WXmToggleButton (topform, "lock", WAutoManage);
  XtVaSetValues(*f_lock, XmNlabelString,
     (XmString)XmStringLocalized(CATGETS(Set_AgentLabel, 196, "Auto Update")),
                         XmNindicatorSize, 15, NULL);
  bool lock_status = pref_mgr().get_boolean (PrefMgr::MapAutoUpdate);
  f_lock->Set(lock_status);
  f_locked = lock_status ;
  // NOTE: Should have a way to remove displayer so that receive function
  // isn't called every time a node is displayed.  14:08 12-Oct-93 DJB 
  UAS_Common::request ((UAS_Receiver<UAS_DocumentRetrievedMsg> *) this);

  f_lock->SetValueChangedCallback(this, (WWL_FUN) &MapAgent::lock_toggle);
  f_porthole->SetReportCallback (this, (WWL_FUN) &MapAgent::porthole_resize);
  f_panner->SetReportCallback (this, (WWL_FUN) &MapAgent::panner_movement);

  bottomform.Manage();
  
  Dimension height;
  f_lock->Get (WArgList (XmNheight, (XtArgVal)&height, NULL));
  topform.Set(WArgList(XmNpaneMinimum, height, NULL));

  topform.Manage();
  f_porthole->Manage();
  pane.Manage();

  /* -------- Callbacks -------- */
  f_wm_delete_callback =
    new WCallback (*f_shell, window_system().WM_DELETE_WINDOW(),
                   this, (WWL_FUN) &MapAgent::close_window);
  close.SetActivateCallback (this, (WWL_FUN) &MapAgent::close_window);

  rootform.Manage();

  //  f_shell->Realize();

  f_tree = NULL;
}
Ejemplo n.º 26
0
void
QueryEditor::create_ui()
{
  Wait_Cursor bob;

  XmStringLocalized mtfstring;
  String	    string;
  KeySym	    mnemonic;

  f_shell = WTopLevelShell(window_system().toplevel(), WPopup, "query_editor");
  window_system().register_shell (&f_shell);

  string = CATGETS(Set_QueryEditor, 1, "Dtinfo: Query Editor");
  XtVaSetValues((Widget)f_shell, XmNtitle, string, NULL);

  // Main form and menu bar. 
  WXmForm form                      (f_shell,    "form"                );
  WXmMenuBar menu_bar               (form,       "menu_bar"            );

  WXmPulldownMenu scope_menu        (form,       "scope_menu");
  Arg args[1];
  int n = 0;
  XtSetArg(args[n], XmNsubMenuId, (Widget) scope_menu); n++;
  f_scope_option = WXmOptionMenu    (form,       "scope_option", AM, args, n);

  mtfstring = CATGETS(Set_AgentLabel, 212, "Scope Name");
  XtVaSetValues(f_scope_option, XmNlabelString, (XmString)mtfstring, NULL);

  // Menu definitions.   how about using AddPushButton (name, obj, fun)??
  WXmCascadeButton edit_cascade     (menu_bar,   "edit",             AM);
  WXmPulldownMenu edit_menu         (menu_bar,   "edit_menu"           );
  f_cut_btn = WXmPushButton         (edit_menu,  "cut",              AM);
  f_copy_btn = WXmPushButton        (edit_menu,  "copy",             AM);
  f_paste_btn = WXmPushButton       (edit_menu,  "paste",            AM);
  f_paste_btn = WXmPushButton       (edit_menu,  "new_term",         AM);
  WXmSeparator group_sep            (edit_menu,  "group_sep",        AM);
  f_group_btn = WXmPushButton       (edit_menu,  "group",            AM);
  f_ungroup_btn = WXmPushButton     (edit_menu,  "ungroup",          AM);
  WXmSeparator undo_sep             (edit_menu,  "undo_sep",         AM);
  f_undo_btn = WXmPushButton        (edit_menu,  "undo",             AM);
  f_redo_btn = WXmPushButton        (edit_menu,  "redo",             AM);

  mtfstring =  CATGETS(Set_AgentLabel, 16, "Edit");
  mnemonic  = *CATGETS(Set_AgentLabel, 17, "E");
  XtVaSetValues(edit_cascade, XmNlabelString, (XmString)mtfstring,
			      XmNmnemonic, mnemonic, NULL);
  mtfstring =  CATGETS(Set_AgentLabel, 224, "Cut");
  XtVaSetValues(f_cut_btn, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring =  CATGETS(Set_AgentLabel, 18, "Copy");
  XtVaSetValues(f_copy_btn, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring =  CATGETS(Set_AgentLabel, 225, "Paste");
  XtVaSetValues(f_paste_btn, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring =  CATGETS(Set_AgentLabel, 226, "Group");
  XtVaSetValues(f_group_btn, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring =  CATGETS(Set_AgentLabel, 227, "Ungroup");
  XtVaSetValues(f_ungroup_btn, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring =  CATGETS(Set_AgentLabel, 228, "Undo");
  XtVaSetValues(f_undo_btn, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring =  CATGETS(Set_AgentLabel, 229, "Redo");
  XtVaSetValues(f_redo_btn, XmNlabelString, (XmString)mtfstring, NULL);

  // Button area at the bottom 
  WXmForm hform                     (form,       "hform"               );
  f_hist_prev = WXmArrowButton      (hform,      "hist_prev",        AM);
  f_hist_next = WXmArrowButton      (hform,      "hist_next",        AM);
  WXmLabel history                  (hform,      "history",          AM);
  f_search_btn = WXmPushButton      (form,       "search",           AM);
  WXmPushButton cancel              (form,       "cancel",           AM);
  WXmPushButton clear               (form,       "clear",            AM);
  WXmPushButton scope		    (form,	 "scope",	     AM);
  WXmPushButton help                (form,       "help",             AM);
  WXmSeparator separator            (form,       "separator",        AM);

  mtfstring =  CATGETS(Set_AgentLabel, 92, "History");
  XtVaSetValues(history, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring =  CATGETS(Set_AgentLabel, 102, "Search");
  XtVaSetValues(f_search_btn, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring =  CATGETS(Set_AgentLabel, 231, "Clear All");
  XtVaSetValues(clear, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring =  CATGETS(Set_AgentLabel, 46, "Scope Editor");
  XtVaSetValues(scope, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring =  CATGETS(Set_AgentLabel, 12, "Close");
  XtVaSetValues(cancel, XmNlabelString, (XmString)mtfstring, NULL);
  mtfstring =  CATGETS(Set_AgentLabel, 48, "Help");
  XtVaSetValues(help, XmNlabelString, (XmString)mtfstring, NULL);

  help_agent().add_activate_help (help, "query_editor_help");

  // Main "work" area 
  WXmPanedWindow pane               (form,       "pane"                );
  WXmForm qform                     (pane,       "qform"               );
  WXmLabel qlabel                   (qform,      "qlabel",           AM);

  mtfstring =  CATGETS(Set_AgentLabel, 230, "Query");
  XtVaSetValues(qlabel, XmNlabelString, (XmString)mtfstring, NULL);
  
  f_query_text = WXmScrolledText    (qform,      "qtext",            AM);
//  f_query_text.SetEditable(False);
  f_query_area = WXmScrolledWindow  (pane,       "query_area",       AM);
  XtUnmanageChild (f_query_area.HorizontalScrollBar());

  edit_cascade.SubMenuId (edit_menu);

  // Callbacks
  ON_ACTIVATE (f_search_btn, search_activate);
  ON_ACTIVATE (cancel, cancel);
  ON_ACTIVATE (clear, clear);
  ON_ACTIVATE (scope, scope);

//  f_query_text.SetFocusCallback (this,
//			    (WWL_FUN) &QueryEditor::modify_verify);
//  f_query_text.SetModifyVerifyCallback (this,
//			    (WWL_FUN) &QueryEditor::modify_verify);

  // Set minimum sizes.
  qform.Manage();
  pane.Manage();
  //  hform.Manage();
  form.DefaultButton (f_search_btn);
  form.ShadowThickness (0);

  form.InitialFocus (pane);
  pane.InitialFocus (f_query_area);
  qform.PaneMinimum (f_query_text.Height());
  form.Manage();

  f_shell.Realize();
  f_shell.MinWidth (f_shell.Width());
  f_shell.MinHeight (f_shell.Height());
  ON_DEBUG(printf ("Query for height = %d\n", qform.Height()));
  //cerr << "Query for height = " << qform.Height() << endl;

//#ifndef UseFJMTF
#if 1
  // Swap the entries in the pane around.  Have to do this now
  // to get initial sizes right.
  qform.PositionIndex (1);
#endif

  fill_menu();

  UAS_SearchScope::request ((UAS_Receiver<ScopeCreated> *) this);
  UAS_SearchScope::request ((UAS_Receiver<ScopeDeleted> *) this);
  UAS_SearchScope::request ((UAS_Receiver<ScopeRenamed> *) this);

  search_scope_mgr().option_menu(this);
}