Esempio n. 1
0
/*
  Allows the R user to set the variables within a given display
 */
USER_OBJECT_
RS_GGOBI(setDisplayVariables)(USER_OBJECT_ vars, USER_OBJECT_ varPrev, USER_OBJECT_ dpy)
{
  displayd *display, *prev_display;
  USER_OBJECT_ ans = NULL_USER_OBJECT;

  display = toDisplay(dpy);
	g_return_val_if_fail(GGOBI_IS_DISPLAY(display), NULL_USER_OBJECT);
  
  /* ensure that display is current before changing variables */
  prev_display = display->ggobi->current_display;
  display_set_current(display, display->ggobi);
  
  /* If any of the requested variables AREN'T selected, select them */
  toggle_display_variables(display, vars, false);
  varpanel_refresh(display, display->ggobi);
  /* If any of the obsolete variables ARE still selected, select (toggle) them */
  toggle_display_variables(display, varPrev, true);
  
  /* refresh everything */
  varpanel_refresh(display, display->ggobi);
  display_tailpipe(display, FULL,  display->ggobi);
  while(gtk_events_pending()) /* ensure display is redrawn */
    gtk_main_iteration();
  
  /* revert to previously selected display */
  display_set_current(prev_display, prev_display->ggobi);
  
  return(ans);
}
Esempio n. 2
0
void
tour1d_all_vars (displayd *dsp) 
{
  GGobiSession *gg = dsp->ggobi;
  GGobiStage *d = dsp->d;
  gint j;

  //gg->tour1d.all_vars = !gg->tour1d.all_vars;

  //if (gg->tour1d.all_vars)
  //{
    for (j=0; j<d->n_cols; j++) {
      dsp->t1d.subset_vars.els[j] = j;
      dsp->t1d.active_vars.els[j] = j;
      dsp->t1d.subset_vars_p.els[j] = true;
      dsp->t1d.active_vars_p.els[j] = true;
    }
    dsp->t1d.nsubset = d->n_cols;
    dsp->t1d.nactive = d->n_cols;
    dsp->t1d.get_new_target = true;
    zero_tau(dsp->t1d.tau, 1);
    varcircles_visibility_set (dsp, gg);
    varpanel_refresh (dsp, gg);

    if (dsp->t1d_window != NULL && GTK_WIDGET_VISIBLE (dsp->t1d_window)) {
      free_optimize0_p(&dsp->t1d_pp_op);
      alloc_optimize0_p(&dsp->t1d_pp_op, d->n_rows, dsp->t1d.nactive, 
        1);
      t1d_pp_reinit(dsp, gg);
    }  
  //}
}
Esempio n. 3
0
void
receive_timeSeries_drag(GtkWidget *src, GdkDragContext *context, int x, int y, const GtkSelectionData *data,   unsigned int info, unsigned int event_time, gpointer *udata)
{
  splotd *to = GGOBI_SPLOT(src), *from, *sp;
  displayd *display;
  display = to->displayptr;
  GList *l;
  gint k;
  GList *ivars = NULL;
  gint xvar;

  from = GGOBI_SPLOT(gtk_drag_get_source_widget(context));

  if(from->displayptr != display) {
      gg_write_to_statusbar("the source and destination of the parallel coordinate plots are not from the same display.\n", display->ggobi);
      return;
  }

  /* Get the x variable */
  sp = (splotd *) (display->splots)->data;
  xvar = sp->xyvars.x;

  /* Gather a list of indices of the vertically plotted variables */
  l = display->splots;
  while (l) {
    sp = (splotd *) l->data;
    ivars = g_list_append(ivars, GINT_TO_POINTER(sp->xyvars.y));
    l = l->next;
  }

  /* Find the index of the to element */
  k = g_list_index(ivars, GINT_TO_POINTER(to->xyvars.y));
  /* Remove the from element */
  ivars = g_list_remove(ivars, GINT_TO_POINTER(from->xyvars.y));
  /* Insert the from element in the position of the to element */
  ivars = g_list_insert(ivars, GINT_TO_POINTER(from->xyvars.y), k);


  /* Assign them to the existing plots */
  k = 0;
  l = display->splots;
  while (l) {
    sp = (splotd *) l->data;
    sp->xyvars.y = GPOINTER_TO_INT(g_list_nth_data(ivars, k));
    k++;
    l = l->next;
  }
  g_list_free(ivars);

  display_tailpipe (display, FULL, display->ggobi);
  varpanel_refresh (display, display->ggobi);
}