Beispiel #1
0
void
BookTab::activate()
{
  Xassert (f_tab_ptr != (const int)0);
  node_mgr().set_preferred_window (f_node_window_agent);
  f_tab_ptr->retrieve();
}
Beispiel #2
0
void
QueryEditor::receive (ScopeDeleted &msg, void* /*client_data*/)
{
  // find the associated button and nuke it
  ON_DEBUG (puts ("QueryEdit: handling delete message"));
  // First find renamed button in our list.
  WidgetList kids = WComposite(f_scope_option.SubMenuId()).Children();
  int num_kids = WComposite(f_scope_option.SubMenuId()).NumChildren();
  int separator_pos = -1;
  for (int i = 0; i < num_kids; i++)
    {
      if (XmIsSeparator (kids[i]))
	separator_pos = i + 1;
      if (msg.f_search_scope ==
	  ((UAS_SearchScope *) WXmPushButton (kids[i]).UserData()))
	break;
    }

  // It had better be in the list! 
  Xassert (i != num_kids);
  ON_DEBUG (printf ("  widget #%d is the button\n", i));

  // if it is selected, select first w/ callback called
  if (kids[i] == f_scope_option.MenuHistory())
    f_scope_option.MenuHistory (kids[1]);
  XtDestroyWidget (kids[i]);

  ON_DEBUG (printf ("QueryEditor: sep pos = %d, kids = %d (%d)\n",
		    separator_pos, num_kids, num_kids - 1));
  if (separator_pos == num_kids - 1)
    {
      ON_DEBUG (puts ("   destroying separator"));
      XtDestroyWidget (kids[separator_pos-1]);
    }
}
Beispiel #3
0
void
MapAgent::set_mode (const map_mode_t mode)
{
  Xassert (mode == LOCAL_MODE || mode == GLOBAL_MODE);

  f_map_mode = mode;
}
Beispiel #4
0
void
ScopeMenu::receive (ScopeRenamed &msg, void *client_data)
{
  ON_DEBUG (puts ("ScopeMenu: handling rename message"));
  // First find renamed button in our list.
  Arg args[2];
  int n;
  Cardinal num_kids;
  WidgetList kids;

  n = 0;
  XtSetArg(args[n], XmNnumChildren, &num_kids); n++;
  XtSetArg(args[n], XmNchildren, &kids); n++;
  XtGetValues(f_pull_menu, args, n);

  unsigned int i;
  for (i = 0; i < num_kids; i++)
    {
      if (XmIsPushButtonGadget (kids[i]) &&
	  msg.f_search_scope ==
	  ((UAS_SearchScope *) WXmPushButtonGadget (kids[i]).UserData()))
	break;
    }

  // It had better be in the list! 
  Xassert (i != num_kids);
  ON_DEBUG (printf ("ScopeMenu: widget #%d is the button\n", i));

  // Now find the new insertion position in the list.
  int position = 0, old_position = i;
  xList<UAS_SearchScope *> &scope_list = search_scope_mgr().scope_list();
  List_Iterator<UAS_SearchScope *> s (scope_list);

  // find the new position in the list
  for (; s != 0; s++)
    {
      if (s.item() == msg.f_search_scope)
	continue;
      position++;
      if (s.item()->read_only())
	continue;
      ON_DEBUG (printf ("ScopeMenu: strcmp <%s>\n", s.item()->name()));
      if (strcmp (msg.f_search_scope->name(), s.item()->name()) < 0)
	break;
    }

  if (s == NULL)
    position++;

  ON_DEBUG (printf ("ScopeMenu: Rename position = %d, old = %d\n",
		    position, old_position));
  WXmPushButtonGadget scope_btn (kids[i]);
  scope_btn.LabelString (msg.f_search_scope->name());
  if (position != old_position)
    scope_btn.PositionIndex (position);
}
Beispiel #5
0
void
BookTab::select_if_same (UAS_Pointer<UAS_Common> &doc_ptr)
{
  Xassert (f_tab_ptr != (const int)0);
  // If this tab points to the Node in question, select the tab,
  // otherwise deselect the tab. 
  if (f_tab_ptr == doc_ptr)
    select();
  else
    deselect();
}
Beispiel #6
0
void
QueryEditor::receive (ScopeRenamed &msg, void* /*client_data*/)
{
  ON_DEBUG (puts ("QueryEdit: handling rename message"));
  // First find renamed button in our list.
  WidgetList kids = WComposite(f_scope_option.SubMenuId()).Children();
  int num_kids = WComposite(f_scope_option.SubMenuId()).NumChildren();
  for (int i = 0; i < num_kids; i++)
    {
      if (msg.f_search_scope ==
	  ((UAS_SearchScope *) WXmPushButton (kids[i]).UserData()))
	break;
    }

  // It had better be in the list! 
  Xassert (i != num_kids);
  ON_DEBUG (printf ("QueryEdit: widget #%d is the button\n", i));

  // Now find the new insertion position in the list.
  int position = 0;
  xList<UAS_SearchScope *> &scope_list = search_scope_mgr().scope_list();
  List_Iterator<UAS_SearchScope *> s (scope_list);

  // find the new position in the list
  for (; s != NULL; s++)
    {
      if (s.item() == msg.f_search_scope)
	continue;
      position++;
      if (s.item()->read_only())
	continue;
      ON_DEBUG (printf ("QueryEdit: strcmp <%s>\n", s.item()->name()));
      if (strcmp (msg.f_search_scope->name(), s.item()->name()) < 0)
	break;
    }

  ON_DEBUG (printf ("QueryEdit: Rename position = %d\n", position));
  WXmPushButton scope_btn (kids[i]);
  scope_btn.LabelString (msg.f_search_scope->name());
  scope_btn.PositionIndex (position);
}
Beispiel #7
0
void
ScopeMenu::receive (ScopeDeleted &msg, void *client_data)
{
  // find the associated button and nuke it
  ON_DEBUG (puts ("ScopeMenu: handling delete message"));
  // First find renamed button in our list.
  Arg args[2];
  int n, theKid;
  Cardinal num_kids;
  WidgetList kids;
  int separator_pos = -1;
  Widget selected;

  n = 0;
  XtSetArg(args[n], XmNmenuHistory, &selected); n++;
  XtGetValues(f_option_menu, args, n);

  n = 0;
  XtSetArg(args[n], XmNnumChildren, &num_kids); n++;
  XtSetArg(args[n], XmNchildren, &kids); n++;
  XtGetValues(f_pull_menu, args, n);

  unsigned int i;
  for (i = 0; i < num_kids; i++)
    {
      if (XmIsSeparator (kids[i]))
      {
	separator_pos = i + 1;
        continue;
      }
      if (XmIsPushButtonGadget (kids[i]) &&
	  msg.f_search_scope ==
	  ((UAS_SearchScope *) WXmPushButtonGadget (kids[i]).UserData()))
	break;
    }

  // It had better be in the list! 
  theKid = i;
  Xassert (theKid != (int) num_kids);
  ON_DEBUG (printf ("widget #%d is the button\n", theKid));

  // if it is selected, select first w/ callback called
  if (kids[theKid] == selected)
    {
      n = 0;
      if (XtIsManaged (kids[0]))
	  XtSetArg(args[n], XmNmenuHistory, kids[0]);
      else
	  XtSetArg(args[n], XmNmenuHistory, kids[1]);
      n++;
      XtSetValues(f_option_menu, args, n);
    }

  XtUnmanageChild (kids[theKid]);
  XtDestroyWidget (kids[theKid]);

  // Get rid of the separator if no user scopes remain.
  ON_DEBUG (printf ("ScopeMenu: sep pos = %d, num_kids = %d (%d)\n",
		    separator_pos, num_kids, num_kids -1 -2));
  // - 1 for deleted widget
  if (separator_pos == (int) (num_kids - 1))
    {
      ON_DEBUG (puts ("   destroying separator"));
      XtDestroyWidget (kids[separator_pos-1]);
    }
}