GUI_PreviewInit (w, h);
GUI_PreviewInit (w, h,1);
on_action (gui_act action){  uint32_t action_parameter;  VF_FILTERS tag = VF_INVALID;  action_parameter = 0;  if (nb_active_filter > 1)    if (getSelectionNumber	(nb_active_filter - 1, WID(treeview2),	 store, &action_parameter))      action_parameter++;  switch (action)    {    case A_SCRIPT:      GUI_FileSelWrite ("Save as script", filterSaveScript);      break;      // Add    case A_ADD:      tag = new_filter ();      // Raise back the old window      gtk_widget_grab_focus (dialog);      //      if (tag != VF_INVALID)	{	  CONFcouple *couple;	  videofilters[nb_active_filter].filter =	    filterCreateFromTag (tag, NULL,				 videofilters[nb_active_filter - 1].filter);	  videofilters[nb_active_filter].filter->	    configure (videofilters[nb_active_filter - 1].filter);	  videofilters[nb_active_filter].filter->getCoupledConf (&couple);	  videofilters[nb_active_filter].tag = tag;	  videofilters[nb_active_filter].conf = couple;	  ;	  nb_active_filter++;	  updateFilterList ();	  //gdk_window_raise(dialog->window);	}      break;    case A_VCD:      setVCD ();      updateFilterList ();      break;    case A_SVCD:      setSVCD ();      updateFilterList ();      break;    case A_DVD:      setDVD ();      updateFilterList ();      break;    case A_HALFD1:      setHalfD1 ();      updateFilterList ();      break;    default:    case A_DOUBLECLICK:      printf ("Double clicked..");    //  break;        case A_CONFIGURE://            void *p;      if (action_parameter)	{	  if (videofilters[action_parameter].filter->	      configure (videofilters[action_parameter - 1].filter))	    {	      CONFcouple *couple;	      videofilters[action_parameter].filter->getCoupledConf (&couple);	      videofilters[action_parameter].conf = couple;//                      updateVideoFilters ();	      getFirstVideoFilter ();	      updateFilterList ();	    }	  // Raise back dialog	  //gtk_window_set_focus(GTK_WINDOW(dialog));	  //gdk_window_raise(dialog->window);	}      break;    case A_PARTIAL:      if (action_parameter)	{	  AVDMGenericVideoStream *replace;	  CONFcouple *conf;	  conf = videofilters[action_parameter].conf;	  if (videofilters[action_parameter].tag == VF_PARTIAL)	// cannot recurse	    {	      GUI_Error_HIG ("The filter is already partial", NULL);	    }	  else	    {	      replace =		new ADMVideoPartial (videofilters[action_parameter - 1].				     filter,				     videofilters[action_parameter].tag,				     conf);	      replace->configure (videofilters[action_parameter - 1].filter);	      delete videofilters[action_parameter].filter;	      if (conf)		delete conf;	      videofilters[action_parameter].filter = replace;	      replace->getCoupledConf (&conf);	      videofilters[action_parameter].conf = conf;	      videofilters[action_parameter].tag = VF_PARTIAL;//                updateVideoFilters ();	      getFirstVideoFilter ();	      updateFilterList ();	    }	}      break;    case A_UP:      if (action_parameter > 1)	// Select file	{	  // swap action parameter & action parameter -1	  FILTER tmp;	  memcpy (&tmp, &videofilters[action_parameter - 1], sizeof (FILTER));	  memcpy (&videofilters[action_parameter - 1],		  &videofilters[action_parameter], sizeof (FILTER));	  memcpy (&videofilters[action_parameter], &tmp, sizeof (FILTER));	  //updateVideoFilters ();	  getFirstVideoFilter ();	  // select action_parameter -1	  updateFilterList ();	  setSelectionNumber (nb_active_filter - 1,			      WID(treeview2),			      store, action_parameter - 2);	}      break;    case A_DOWN:      if (((int) action_parameter < (int) (nb_active_filter - 1)) && (action_parameter))	// Select file	{	  // swap action parameter & action parameter -1	  FILTER tmp;	  memcpy (&tmp, &videofilters[action_parameter + 1], sizeof (FILTER));	  memcpy (&videofilters[action_parameter + 1],		  &videofilters[action_parameter], sizeof (FILTER));	  memcpy (&videofilters[action_parameter], &tmp, sizeof (FILTER));	  // updateVideoFilters ();	  getFirstVideoFilter ();	  updateFilterList ();	  setSelectionNumber (nb_active_filter - 1,			      WID(treeview2),			      store, action_parameter);	}      break;    case A_REMOVE://              CONFcouple *couple;      VF_FILTERS tag;      AVDMGenericVideoStream *old;      if (action_parameter > 0)	{	  // we store the one we will delete	  if (videofilters[action_parameter].conf)	    {	      delete videofilters[action_parameter].conf;	      videofilters[action_parameter].conf = NULL;	    }	  // recreate derivated filters	  for (uint32_t i = action_parameter + 1; i < nb_active_filter; i++)	    {	      old = videofilters[i - 1].filter;	      tag = videofilters[i].tag;	      videofilters[i - 1].filter = filterCreateFromTag (tag,								videofilters								[i].conf,								videofilters[i									     -									     2].								filter);	      videofilters[i - 1].conf = videofilters[i].conf;	      videofilters[i - 1].tag = tag;	      delete old;	    }	  delete videofilters[nb_active_filter - 1].filter;	  videofilters[nb_active_filter - 1].filter = NULL;	  nb_active_filter--;	}      updateFilterList ();      break;    case A_DONE:      break;    case A_PREVIEW:      if (action_parameter > 0)	{	  AVDMGenericVideoStream *in;	  uint32_t w, h, l, f;	  ADMImage *data;	  extern uint32_t curframe;	  in = videofilters[action_parameter].filter;	  w = in->getInfo ()->width;	  h = in->getInfo ()->height;	  data = new ADMImage (w, h);	//(uint8_t *) malloc (w * h * 3);	  ADM_assert (data);	  in->getFrameNumberNoAlloc (curframe, &l, data, &f);	  GUI_PreviewInit (w, h);	  GUI_PreviewRun (data->data);	  GUI_PreviewEnd ();	  ADM_dealloc (data);	}      break;    case A_LOAD:#ifdef USE_LIBXML2      GUI_FileSelRead ("Load set of filters", filterLoadXml);#else      GUI_FileSelRead ("Load set of filters", filterLoad);#endif      updateFilterList ();      break;    case A_SAVE:      if (nb_active_filter < 2)	{	  GUI_Error_HIG ("Nothing to save", NULL);	}      else#ifdef USE_LIBXML2	GUI_FileSelWrite ("Save set of filters", filterSaveXml);#else	GUI_FileSelWrite ("Save set of filters", filterSave);#endif      break;#if 0    default:      printf ("Unknown action :%d, action param %d\n", action,	      action_parameter);      ADM_assert (0);#endif    }  //updateFilterList();}