Example #1
0
/*--------------------------------------------------------------------
 * event handler
 *
 */
void info_viewer::handle_event( event& e ) {
  inherited::handle_event(e);

  switch (e.kind()) {
  case SELECTION:
    {
      if ( e.get_source() == text ) {
	return;	// ignore local selection
      }
      view( e.get_object() );
    }
    break;
  case INVOCATION:
    {
      if ( e.get_source() == text ) {
	/* local event */
	view( e.get_object() );
      }
    }
    break;
  case CLOSE_FILESET:
  case NEW_FILESET:
    {
      clear();
    }
    break;
  case REFRESH:
  case PROC_MODIFIED:
  case FSE_MODIFIED:
    {
      refresh();
    }
    break;
  default:
    break;
  }
}
Example #2
0
static void
do_go_cmd(const event& e, void*)
{
  binding *b;
  char *node_name;
  char *node_info;

  vmenu *menu = (vmenu *) e.get_source();
  menu->clear("Go");

  b = new binding((bfun) &do_go_back_cmd, 0);
  menu->add_command(b, "Go", "Back");

  menu->add_separator("Go");

  /* construct list of previously selected objects */
  vnode_list *hist = vman->get_selection_history();

  for ( s_count_t i=1; /* jump over current object */
        (i<20) && (i<hist->size()); i++ ) {
    vnode *vn = (*hist)[i];
    char *tag = vn->get_tag();

    if ( tag == tag_suif_object ) {
      SuifObject *obj = (SuifObject *) vn->get_object();
      node_info = (char*)obj->get_meta_class()->get_class_name().c_str();
    } else if (tag == tag_code_fragment) {
      node_info = "";
    } else {
      suif_assert_message( false, ("Unknown tag") );
    }

    node_name = new char[strlen(tag)+strlen(node_info)+100 /*just to be safe*/];

    sprintf(node_name, "[%s] (0x%p) %s", tag, vn->get_object(), node_info);

    b = new binding((bfun) &do_go_to_node_cmd, vn);
    menu->add_command(b, "Go", node_name);

    delete [] node_name;
  }
}
Example #3
0
/*--------------------------------------------------------------------
 * event handler
 *
 * when a event occurs, this function is invoked
 */
void src_viewer::handle_event( event& e ) {
  inherited::handle_event( e );

  switch ( e.kind() ) {
  case SELECTION:
    {
      vnode* vn = e.get_object();
      void* event_source = e.get_source();
      if ( event_source == text ) return; // ignore local event
      show( vn );
    }
    break;

  case CLOSE_FILESET:
    {
      clear_cache();
      clear();
    }
    break;

  case NEW_FILESET:
    {
      /* show the first file_block */
      FileSetBlock* file_set = suif_env->get_file_set_block();
      if (file_set) {
        view(file_set->get_file_block(0));
      }
    }
    break;
  case REFRESH:
  case PROC_MODIFIED:
  case FSE_MODIFIED:
    {
      refresh();
    }
    break;

  default:
    break;
  }
}
Example #4
0
/*--------------------------------------------------------------------
 * event handler
 *
 * when a event occurs, this function is invoked
 */
void
output_viewer::handle_event(event& e)
{
  inherited::handle_event( e );

  switch ( e.kind() ) {
  case SELECTION:
    {
      void* event_source = e.get_source();
      if (event_source == text) return; // ignore local event
      show( e.get_object() );
    }
    break;

  case CLOSE_FILESET:
    {
      clear();
    }
    break;

  default:
    break;
  }
}