Exemple #1
0
UAS_Pointer<Graphic>
GraphicsMgr::get(UAS_Pointer<UAS_Common> &node_ptr, const char *locator)
{

#if 0
  // iterate through the list looking for our graphic.

  List_Iterator<Graphic * > cursor (&f_graphic_cache);

  for (; cursor; cursor++)
    if (cursor.item()->locator() == locator)
      return cursor.item();
#endif

  //Graphic *gr = new Graphic (node_ptr, locator);
  UAS_Pointer<Graphic> gr(new Graphic (node_ptr, locator));

#if 0
  f_graphic_cache.insert (gr);
#endif

  if(is_detached(gr))
  {
    //init_gr(gr);
    gr->set_detached(TRUE);
  }

  return gr;
}
Exemple #2
0
void
MarkIcon::insert (MarkCanvas *mark_canvas)
{
  mark_canvas->set_mark_icon (this);

  // Insert the new mark in the mark list in sorted order. 
  List_Iterator<MarkCanvas *> m (f_mark_list);
  while (m && mark_canvas->offset() > m.item()->offset())
    m++;

  // Check for last mark in the icon (ie: start of list)
  if (m == NULL)
    {
      f_offset = mark_canvas->offset();
      f_mark_list.append (mark_canvas);
    }
  else
    {
      f_mark_list.insert_before (m, mark_canvas);
    }

  // BUG ALERT!! 
  // If mark_canvas is first item in list, we might have a problem
  // since the later items in the list may no longer overlap it :-(

  if (mark_canvas->selected())
    highlight();

  update_icon (mark_canvas);
}
Exemple #3
0
void 
MarkIcon::double_click(XEvent *event)
{
 
  if (mark_count() == 1)
  {
      List_Iterator<MarkCanvas *> m (f_mark_list);
	  m.item()->select();
	  m.item()->mark_ptr()->edit();
  }
  else // mark_mark_count() > 1
  {
      assert (mark_count() > 1);

      if (g_timeout) {
	delete g_timeout;
	g_timeout = NULL;
      }

      UAS_String title  = CATGETS(Set_MarkChooser, 2, "Dtinfo: Edit Mark");
      UAS_String btitle = CATGETS(Set_AgentLabel, 16, "Edit");
      MarkChooser chooser (f_chooser_parent, f_mark_list,
					(char*)title, (char*)btitle);
	  
      MarkCanvas *choice = chooser.get_choice();
      if (choice != NULL)
      {
        choice->select();
        choice->mark_ptr()->edit();
      }
   }
}
Exemple #4
0
int32_t MemoryAllocator::Sanitize (List_Iterator <MemoryChunk> &List)
{
	  if (List.Contain() < 2) {
			return -1;
		} else {}
		MemoryChunk *New = List.GetLast()->llink, *Old = List.GetLast();
		while (New != (MemoryChunk *)0) {
			if ((alloc_addr_t)Old + Old->size + sizeof(MemoryChunk) == (alloc_addr_t)New) {
				Old->size += sizeof(MemoryChunk) + New->size;
				List - New;
        this->Sanitized++;
			}
			Old = New;
			New = New->llink;
		}	
		New = List.GetFirst()->rlink;
		Old = List.GetFirst();
		while (New != (MemoryChunk *)0) {
			if ((alloc_addr_t)Old + Old->size + sizeof(MemoryChunk) == (alloc_addr_t)New) {
				Old->size += sizeof(MemoryChunk) + New->size;
				List - New;
        this->Sanitized++;
			}
			Old = New;
			New = New->rlink;
		}	
    return 0;		
}
Exemple #5
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);
}
Exemple #6
0
void
MarkIcon::swap_colors()
{
  // Swap the fg and bg colors.

  int multi = mark_count() > 1;
  int anno  = False;

  List_Iterator<MarkCanvas *> m (f_mark_list);
  while (m)
    {
      if (*(m.item()->mark_ptr()->notes()) != '\0')
	{
	  anno = True;
	  break;
	}
      m++;
    }

  Pixel background, foreground;

  if (f_selected == FALSE) { // about to select
    foreground = Background();
    background = Foreground();
  }
  else {		     // about to de-select
    foreground = Foreground();
    background = Background();
  }

  Pixmap button_pixmap;

  if (anno) {
    if (multi)
      button_pixmap = XmGetPixmap(window_system().screen(),(char*)"anno_double",
				  foreground, background);
    else
      button_pixmap = XmGetPixmap(window_system().screen(),(char*)"anno_single",
				  foreground, background);
  }
  else {
    if (multi)
      button_pixmap = XmGetPixmap(window_system().screen(),(char*)"mark_double",
				  foreground, background);
    else
      button_pixmap = XmGetPixmap(window_system().screen(),(char*)"mark_single",
				  foreground, background);
  }

  if (button_pixmap && button_pixmap != XmUNSPECIFIED_PIXMAP) {
    LabelPixmap(button_pixmap);
  }

}  
Exemple #7
0
void
MarkIcon::activate (WCallback *wcb)
{
  CALL_DATA (XmPushButtonCallbackStruct, pbcs);

  if (mark_count() == 1)
    {
      List_Iterator<MarkCanvas *> m (f_mark_list);
      if (pbcs->click_count == 1)
	{
	  if (!f_selected)
	    m.item()->select();
	  else
	    m.item()->deselect();
	}
      else if (pbcs->click_count == 2)
	{
	  m.item()->select();
	  m.item()->mark_ptr()->edit();
	}
    }
  else // mark_mark_count() > 1
    {
      assert (mark_count() > 1);
      
      if (pbcs->click_count == 1)
	{
	  // Use the double click delay plus 20 milliseconds. 
	  int delay = XtGetMultiClickTime (XtDisplay (widget)) + 2000;
	  g_timeout =
	    new WTimeOut (window_system().app_context(), delay, this,
			  (WTimeOutFunc) &MarkIcon::select_mark_timeout);
		
	}
      else if (pbcs->click_count == 2)
	{
	  delete g_timeout;
	  g_timeout = NULL;

	  UAS_String title  = CATGETS(Set_MarkChooser, 2, "Dtinfo: Edit Mark");
	  UAS_String btitle = CATGETS(Set_AgentLabel, 16, "Edit");
	  MarkChooser chooser (f_chooser_parent, f_mark_list,
					(char*)title, (char*)btitle);
	  
	    MarkCanvas *choice = chooser.get_choice();
	    if (choice != NULL)
	      {
	        choice->select();
	        choice->mark_ptr()->edit();
	      }

	}
    }
}
Exemple #8
0
void
QueryEditor::receive (ScopeCreated &msg, void* /*client_data*/)
{
  int position = 0;
  const char *scope_name = msg.f_search_scope->name();
  xList<UAS_SearchScope *> &scope_list = search_scope_mgr().scope_list();
  List_Iterator<UAS_SearchScope *> s (scope_list);
  bool need_sep = TRUE;

  if (msg.f_search_scope->read_only())
  {
    // insert read-only scopes at the start; reserve position 0
    // for "Current Section" scope and position 1 for
    // the "All Libraries" scope
    position = 2;
    need_sep = FALSE;
  }
  else
  {
    // Scan the current menu to find the correct insertion position. 
    UAS_SearchScope *scope;
    for (; s != NULL; s++, position++)
    {
      scope = s.item();
      if (scope->read_only() != need_sep)
      {
        position++;  // skip separator
        need_sep = FALSE;
      }
      if (scope->read_only())
	continue;
      // Find the first item that the new entry belongs after.
      ON_DEBUG (printf ("Scope Edit strcmp to <%s>\n", s.item()->name()));
      if (strcmp (scope_name, scope->name()) < 0)
	break;
    }
  }

  ON_DEBUG (printf ("Final SE position = %d\n", position));

  // Add a separator if this is the first user-defined entry. 
  if (need_sep == TRUE)
  {
    DECLM (WXmSeparator, separator, f_scope_option.SubMenuId(), "separator");
    separator.PositionIndex (position);
    position++;
  }

  // Create the new toggle button. 
  DECLM (WXmPushButton, scope, f_scope_option.SubMenuId(), scope_name);
  scope.PositionIndex (position);
  scope.UserData (msg.f_search_scope);
}
Exemple #9
0
void
QueryEditor::fill_menu()
{
  int position = 0;
  // Create push buttons for each scope.
  xList<UAS_SearchScope *> &scope_list = search_scope_mgr().scope_list();
  List_Iterator<UAS_SearchScope *> s (scope_list);
  bool old_read_only = TRUE;

  for (; s != NULL; s++)
    {
      // Add a separator when they change from read only to changable. 
      if (old_read_only != s.item()->read_only())
	{
	  DECLM (WXmSeparator, sep1, f_scope_option.SubMenuId(), "separator");
          sep1.PositionIndex (position++);
	  old_read_only = FALSE;
	}
      DECLM (WXmPushButton, scope,f_scope_option.SubMenuId(),s.item()->name());
      scope.UserData (s.item());
      scope.PositionIndex (position++);
    }

  // Do not want first item (Current Section)

#ifdef __osf__
#if 1
  Widget w = f_scope_option.SubMenuId();
  WComposite temp_composite(w);
  WXmPushButton(temp_composite.Children()[0]).Unmanage();
#else
  int i = 0;
  Widget w = f_scope_option.SubMenuId();;
  Arg args[1];
  WidgetList wl;
  
  XtSetArg(args[i], XmNchildren, &wl); i++;
  XtGetValues(w, args, i);
  XtUnmanageChild(wl[0]);
#endif
#else
  WXmPushButton(WComposite(f_scope_option.SubMenuId()).Children()[0]).Unmanage();
#endif

  f_scope_option.
      MenuHistory (WComposite(f_scope_option.SubMenuId()).Children()[1]);
  
  //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);
}
Exemple #10
0
Sender<T>::~Sender()
{
  ON_DEBUG (printf ("~Sender() @ 0x%p\n", this));
  List_Iterator<Receiver<T> *> i (f_receiver_list);

  while (i)
    {
      ON_DEBUG (printf ("  Notify Receiver 0x%x\n", i.item()));
      i.item()->remove (this);
      f_receiver_list.remove (i);
    }
}
Exemple #11
0
void
MarkIcon::remove (MarkCanvas *mark_canvas)
{
  mark_canvas->set_mark_icon (NULL);
  f_mark_list.remove (mark_canvas);

  // See if we need to recompute the offset. 
  if (mark_count() > 0 && mark_canvas->offset() == f_offset)
    {
      List_Iterator<MarkCanvas *> m (f_mark_list);
      m.last();
      f_offset = m.item()->offset();
    }
  update_icon (NULL);
}
Exemple #12
0
MarkIcon::~MarkIcon()
{
  List_Iterator<MarkCanvas *> m (f_mark_list);
  while (m)
    {
      m.item()->set_mark_icon (NULL);
      m++;
    }

  if (g_timeout) {
    delete g_timeout;
    g_timeout = NULL;
  }

  XtDestroyWidget (widget);
}
Exemple #13
0
// getCurrentSections()
//
// get the sections actually on display [right now] in all known
// node view windows, in their unique id format (i.e., not fully-qualified)
//
UAS_List<UAS_String>
EnvMgr::getCurrentSections()
{
  UAS_List<UAS_String> f_sections ;

  // get current section IDs from each node view visible
  xList<NodeWindowAgent *> &nwl = node_mgr().windows() ;

  List_Iterator<NodeWindowAgent *> nwli (nwl) ;
  for ( ; nwli; nwli ++)
  {
    f_sections.insert_item(
         new UAS_String(nwli.item()->node_view_info()->node_ptr()->id()) ) ;
  }
  return f_sections ;
}
Exemple #14
0
GraphicAgent*
GraphicsMgr::get_agent(UAS_String &locator)
{
  // iterate through the list looking for our graphic.
  // if our graphic is in the list, return it.
  // Otherwise, return NULL.
  List_Iterator<GraphicAgent*> dgl (&f_detached_list);

  for (; dgl; dgl++)
  {
    UAS_Pointer<Graphic> gr(dgl.item()->graphic());
    if (gr->locator() == locator)
      return dgl.item();
  }
  return NULL;
}
Exemple #15
0
bool
GraphicsMgr::is_detached(UAS_Pointer<Graphic> &gr)
{
  // iterate through the list looking for our graphic.
  // if our graphic is in the list, return True.
  // Otherwise, return False.
  List_Iterator<GraphicAgent*> dgl (&f_detached_list);

  for (; dgl; dgl++)
  {
   UAS_Pointer<Graphic> g = dgl.item()->graphic();
    if (gr->locator() == g->locator())
    {
      return True;
    }
  }
  return False;
}
Exemple #16
0
Mark_mmdb *
MarkBase_mmdb::find_mark (oid_t &id, UAS_Pointer<UAS_Common> &doc_ptr)
{
  List_Iterator<Mark_mmdb *> m (f_mark_cache);

  while (m)
    {
      if (m.item()->id().eq (id))
	return (m.item());
      m++;
    }

  // Didn't find it, so create a new Mark and cache it.
  // Mark creation may throw an Exception, which our caller catches. 
  Mark_mmdb *mark = new Mark_mmdb (*this, id, doc_ptr);
  f_mark_cache.insert (mark);
  return (mark);
}
Exemple #17
0
void
NodeViewInfo::add_graphic(UAS_Pointer<Graphic> &pg)
{
  f_pixmap_list.append(pg);

#ifdef DEBUG
  printf( "NodeViewInfo: add UAS_Pointer<Graphic> %p\n", pg );
  if (f_pixmap_list != NULL)
  {
      List_Iterator<UAS_Pointer<Graphic> > gli (f_pixmap_list) ;
      printf( "graphics list is now: " );
      while (gli)
      {
        printf( " %p ", gli.item() );
        gli++;
      }
      printf( "\n" );
  }
#endif
}
Exemple #18
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);
}
Exemple #19
0
template <class T> void
Sender<T>::send_message (const T &message)
{
  ON_DEBUG (printf ("Sender::send() from 0x%p (len = %d)\n",
		    this, f_receiver_list.length()));
  List_Iterator<Receiver<T> *> i;

  //
  //  SWM: Modify the loop slightly to take into account
  //  the possibility of the guy we're currently sending to
  //  removing himself from the list when he receives this
  //  message. This is a bit dangerous as it depends on the
  //  implementation of list iterators.
  //
  for (i = f_receiver_list; i != NULL; )
    {
      Receiver<T> *cur = i.item();
      i ++;
      ON_DEBUG (printf ("  sending to 0x%x\n", i.item()));
      cur->receive((T &) message);
    }
}
Exemple #20
0
/*
 * ------------------------------------------------------------------------
 * Name:  reset_ui
 *
 * Description:
 *     Resets the number of nodes and what to print buttons.
 *
 * Return value:
 *     None.
 *
 */
void
reset_ui(AppPrintData *p)
{
   RCS_DEBUG("reset_ui called.\n");   

    xList<UAS_Pointer<UAS_Common> > &print_list = *(p->f_print_list);
    Xassert (print_list.length() > 0);
    
    // Set up the "Number of Nodes" labels. 
    static char buffer[24];

    snprintf (buffer, sizeof(buffer), "%d", print_list.length());
    f_selected_field.LabelString (WXmString (buffer));
    f_to_print_field.LabelString (WXmString (buffer));
    
    // Set up "What to print" buttons based on command line 
    // value set in Window System 

    print_hierarchy = window_system().videoShell()->hierarchy;

    f_print_hierarchy.Set(print_hierarchy);
    f_print_nodes.Set(!print_hierarchy);
    
    Boolean hierarchy_sensitive = False;
    
    List_Iterator<UAS_Pointer<UAS_Common> > l (print_list);

    // NOTE: Could fail if toc() is NULL. 
    UAS_List<UAS_Common> kids = l.item()->children();
    if ((!strncmp(l.item()->locator(), "mmdb:", 5)) && print_list.length() == 1 && kids.length() > 0) {
	hierarchy_sensitive = True;
    }
    
    // If one is insensitive, the other one must be as well. 
    f_print_nodes.SetSensitive (hierarchy_sensitive);
    f_print_hierarchy.SetSensitive (hierarchy_sensitive);

}
Exemple #21
0
void
GraphicsMgr::remove_detached(GraphicAgent *ga)
{
  // iterate through the list looking for our graphic.
  // if our graphic is in the list, return it.
  // Otherwise, return NULL.
  List_Iterator<GraphicAgent*> dgl (&f_detached_list);
  if (ga == NULL)
  {
    return;
  }
  UAS_Pointer<Graphic> oldgr = ga->graphic();

  for (; dgl; dgl++)
  {
    UAS_Pointer<Graphic> gr(dgl.item()->graphic());
    if (gr->locator() == oldgr->locator())
    {
      f_detached_list.remove(ga);
      break;
    }
  }
}
Exemple #22
0
void 
MarkIcon::single_click(XEvent *event)
{

  if (mark_count() == 1)
    {
      List_Iterator<MarkCanvas *> m (f_mark_list);
	  if (!f_selected)
	    m.item()->select();
	  else
	    m.item()->deselect();
    }
  else // mark_mark_count() > 1
    {
      assert (mark_count() > 1);

      // Use the double click delay plus 30 milliseconds. 
      int delay = XtGetMultiClickTime (XtDisplay (widget)) + 30;
      g_timeout =
        new WTimeOut (window_system().app_context(), delay, this,
		  (WTimeOutFunc) &MarkIcon::select_mark_timeout);
    }
}
Exemple #23
0
/*
 * ------------------------------------------------------------------------
 * Name: PrintEverything
 *
 * Description:
 *
 *     Called when the print shell receives the XP events. Contains the 
 *     logic for printing all topics.
 *
 */
static void 
PrintEverything(AppPrintData *p)
{
    int cur_page = 0;
    
    RCS_DEBUG("PrintEverything called.\n");

    xList<UAS_Pointer<UAS_Common> > &print_list = *(p->f_print_list);
    Xassert (print_list.length() > 0);

    l_AppPrintData = p;
    Widget pshell = p->f_print_shell;

    List_Iterator<UAS_Pointer<UAS_Common> > l (print_list);

    while (l)
    {
	PrintOneUASCommon(l.item(), pshell, &cur_page);
	l++;
    }

    RCS_DEBUG("PrintEverything exiting.\n");
}
Exemple #24
0
void
ScopeMenu::receive (UpdateMenu &msg, void *client_data)
{
  xList<UAS_SearchScope *> &scope_list = search_scope_mgr().scope_list();
  List_Iterator<UAS_SearchScope *> s (scope_list);

  int n;
  Arg args[2];
  WidgetList kids;
  Cardinal num_kids;

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

  // destroy all toggle buttons in menu
  for (unsigned int i = 0; i < num_kids; i++)
  {
    XtUnmanageChild (kids[i]);
    XtDestroyWidget (kids[i]);
  }

  // select current scope
  if(f_use_current_section)
    f_current_scope = s.item();
  else
  {
    s++;
    f_current_scope = s.item();
  }
  fill_menu();
  XtUnmanageChild(XtParent(f_option_menu));
  XtManageChild(XtParent(f_option_menu));
  XtUnmanageChild(f_option_menu);
  XtManageChild(f_option_menu);
}
Exemple #25
0
NodeViewInfo::~NodeViewInfo()
{
  _DtLinkDbDestroy(f_topic->link_data);	// kill the link database

  cleanup(f_topic->seg_list);	// kill the segments and their items

  f_topic->seg_list = 0 ;
  delete f_topic ;		// sayonara

  if (f_pixmap_list != NULL)
  {		// explicitly cleanup graphics in f_pixmap_list
    List_Iterator<UAS_Pointer<Graphic> > gli (f_pixmap_list) ;
    while (gli)
    {
#ifdef DEBUG
      printf( "delete UAS_Pointer<Graphic> gli.item() = %p\n", gli.item() );
#endif
      f_pixmap_list.remove(gli) ;
    }
  }
#ifdef DEBUG
  printf( "kill NodeViewInfo %p\n\n", this );
#endif
}
Exemple #26
0
void
MarkIcon::update_icon (MarkCanvas *)
{
  Pixmap button_pixmap = 0;

  int multi = mark_count() > 1;
  int anno  = False;


  List_Iterator<MarkCanvas *> m (f_mark_list);
  while (m)
    {
      if (*(m.item()->mark_ptr()->notes()) != '\0')
	{
	  anno = True;
	  break;
	}
      m++;
    }

  if (anno) {
    if (multi)
      button_pixmap = XmGetPixmap(window_system().screen(),(char*)"anno_double",
				  Foreground(), Background());
    else
      button_pixmap = XmGetPixmap(window_system().screen(),(char*)"anno_single",
				  Foreground(), Background());
  }
  else {
    if (multi)
      button_pixmap = XmGetPixmap(window_system().screen(),(char*)"mark_double",
				  Foreground(), Background());
    else
      button_pixmap = XmGetPixmap(window_system().screen(),(char*)"mark_single",
				  Foreground(), Background());
  }

  if (button_pixmap && button_pixmap != XmUNSPECIFIED_PIXMAP) {
    LabelPixmap(button_pixmap);
  }
  else {
#ifdef BOOKMARK_DEBUG
    cerr << "XmGetPixmap failed." << endl;
#endif
  }

#if 0
  static char buf[2];
  *buf = OLIAS_BOOKMARK_ICON;

  List_Iterator<MarkCanvas *> m (f_mark_list);
  while (m)
    {
      if (*(m.item()->mark_ptr()->notes()) != '\0')
	{
	  *buf = OLIAS_ANNOTATION_ICON;
	  break;
	}
      m++;
    }

  // NOTE: Slight hack here.  Depends on multi-icons being uppercase version
  // of single icons.  DJB 10/27/92 
  if (mark_count() > 1)
    *buf = toupper (*buf);

  if (f_icon_char != *buf)
    {
      f_icon_char = *buf;
      LabelString (buf);
    }
#endif
}
Exemple #27
0
void
ToggleWhatCB(
    Widget widget,
    XtPointer client_data,
    XtPointer call_data)
{
    RCS_DEBUG("ToggleWhatCB called.\n");   

    AppPrintData * p = (AppPrintData *)client_data;
    
    xList<UAS_Pointer<UAS_Common> > &print_list = *(p->f_print_list);
    
    static char buffer[24];
    WXmToggleButton other (NULL), active(widget);
    
    ON_DEBUG (printf ("PrintPanel::ToggleWhatCB (%p)\n", widget));
    
    Xassert ( (widget == (Widget)f_print_nodes) || (widget == (Widget)f_print_hierarchy));
    
    // Figure out which one is the other one (ie: not clicked on). 
    if (active == f_print_nodes) 
    {
	other = f_print_hierarchy;
    }
    else 
    {
	other = f_print_nodes;
    }
    
    active.Set (True);
    other.Set (False);
    
    if (active == f_print_nodes)
    {
	snprintf (buffer, sizeof(buffer), "%d", print_list.length());
	print_hierarchy = False;
    }
    else // active == f_print_hierarchy 
    {
	List_Iterator<UAS_Pointer<UAS_Common> > l (print_list);
	int subtree_size = l.item()->subtree_size ();

	if (subtree_size != 0)
	{
	    snprintf (buffer, sizeof(buffer), "%d", subtree_size);
	}
	else
	{
	    *((char *) memcpy(buffer, "?", 1) + 1) = '\0';
	}
	print_hierarchy = True;
    }
    
    if (*buffer == '0') 
    {
	*buffer = '?';
    }
    f_to_print_field.LabelString (WXmString (buffer));

    RCS_DEBUG("ToggleWhatCBB exiting.\n");   

}
Exemple #28
0
void
ScopeMenu::fill_menu()
{
  int position = 0;
  Wait_Cursor bob;

  // Create toggle buttons for each scope.
  xList<UAS_SearchScope *> &scope_list = search_scope_mgr().scope_list();
  List_Iterator<UAS_SearchScope *> s (scope_list);
  bool old_read_only = TRUE;

  // Set the current scope to the first entry
  //  (Current Section or Information Library) 
  f_current_scope = s.item();

  ON_DEBUG(cerr << "Scope Popup" << endl);

  int first = TRUE;
  for (; s != 0; s++)
    {
      
      // in case we are not using Current Section
      if (f_current_scope == NULL)
	f_current_scope = s.item();

      ON_DEBUG(cerr << "\t" << f_current_scope->name() << endl);
//    ON_DEBUG(f_current_scope->dump_items());

      // Add a separator when they change from read only to changable. 
      if (old_read_only != s.item()->read_only())
	{
	  DECLM (WXmSeparator, sep1, f_pull_menu, "separator");
          sep1.PositionIndex (position++);
	  old_read_only = FALSE;
	}
      DECLM (WXmPushButtonGadget, scope, f_pull_menu, s.item()->name());
      if (first && !f_use_current_section)
	{
	  first = FALSE;
	  scope.Unmanage();
	  // Reset current scope so that it is set to Library on next pass.
	  f_current_scope = NULL;
	}
      scope.UserData (s.item());
      scope.PositionIndex (position++);

      WCallback *cb = SET_CALLBACK(scope,Activate,set_scope);
      SET_CALLBACK_D (scope,Destroy,destroy_scope,cb);
      if (f_current_scope == s.item())
	{
	  Arg args[1];
	  int n = 0;
	  XtSetArg(args[n], XmNmenuHistory, (Widget)scope); n++;
	  XtSetValues(f_option_menu, args, n);
	}
    }

  //UAS_SearchScope::request ((UAS_Receiver<ScopeCreated> *) this);
  //UAS_SearchScope::request ((UAS_Receiver<ScopeDeleted> *) this);
  //UAS_SearchScope::request ((UAS_Receiver<ScopeRenamed> *) this);
}
Exemple #29
0
void
ScopeMenu::receive (ScopeCreated &msg, void *client_data)
{
  int position = 0;
  const char *scope_name = msg.f_search_scope->name();
  xList<UAS_SearchScope *> &scope_list = search_scope_mgr().scope_list();
  List_Iterator<UAS_SearchScope *> s (scope_list);
  bool need_sep = TRUE;

  int n;
  Arg args[2];
  WidgetList kids;
  Cardinal num_kids;

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

  UAS_SearchScope *scope;

  if (msg.f_search_scope->read_only())
  {
    // insert read-only scopes at the start; reserve position 0
    // for "Current Section" scope and position 1 for
    // the "All Libraries" scope
    position = 2;
    need_sep = FALSE;
  }
  else
  {
    // Scan the current menu to find the correct insertion position. 
    for (; s != 0; s++, position++)
    {
      scope = s.item();
      if (need_sep != scope->read_only())
      {
        position++;  // skip separator
        need_sep = FALSE;
      }
      if (scope->read_only())
	continue;
      // Find the first item that the new entry belongs after.
      ON_DEBUG (printf ("Scope strcmp to <%s>\n", scope->name()));
      if (strcmp (scope_name, scope->name()) < 0)
	break;
    }
  }

  ON_DEBUG (printf ("Final position = %d\n", position));

  // Add a separator if this is the first user-defined entry. 
  if (need_sep == TRUE)
  {
    DECLM (WXmSeparator, separator, f_pull_menu, "separator");
    separator.PositionIndex (position);
    position++;
  }

  // Create the new toggle button. 
  DECLM (WXmPushButtonGadget, scope_btn, f_pull_menu, scope_name);
  scope_btn.PositionIndex (position);
  scope_btn.UserData (msg.f_search_scope);
  WCallback *cb = SET_CALLBACK(scope_btn,Activate,set_scope);
  SET_CALLBACK_D(scope_btn,Destroy,destroy_scope,cb);
}