ricfileEditor* openRicfile::get_viewer(){
	switch( editor ){
		case simple_mode:
				if( !editor_simple ){
					editor_simple = new ricfileEditorSimple( openRicfile::parent );
					QObject::connect( editor_simple, SIGNAL( file_edited() ), parent, SLOT( update_tab() ) );
				}
				return editor_simple;
		case advanced_mode:
				if( !editor_advanced ){
					editor_advanced = new ricfileEditorAdvanced( openRicfile::parent );
					QObject::connect( editor_advanced, SIGNAL( file_edited() ), parent, SLOT( update_tab() ) );
				}
				return editor_advanced;
		case font_mode: return NULL;
	}
	
	return NULL;	//This will only happen if it was passed an faulty viewer!
}
void 		fall_token(t_all *all)
{
  mvt_drop(all);
  make_xy_tab(all);
  if (all->update == '1')
    {
      all->update = '0';
      update_tab(all);
    }
  print_game_info(all);
}
Exemple #3
0
/****** save_tab **************************************************************
PROTO	void save_tab(catstruct *cat, tabstruct *tab)
PURPOSE	Save a FITS table.
INPUT	pointer to the catalog structure,
	pointer to the table structure.
OUTPUT	-.
NOTES	-.
AUTHOR	E. Bertin (IAP & Leiden observatory)
VERSION	09/09/2003
 ***/
void	save_tab(catstruct *cat, tabstruct *tab)

{
	catstruct	*tabcat;
	keystruct	*key;
	tabstruct	*keytab;
	KINGSIZE_T	tabsize;
	KINGLONG	size;
	int		b,j,k,o, nbytes,nkey,nobj,spoonful,
	tabflag, larrayin,larrayout;
	char		*buf, *inbuf, *outbuf, *fptr,*ptr;
	int		esize;

	/*  Make the table parameters reflect its content*/
	update_tab(tab);
	/*  The header itself*/
	tabflag = save_head(cat, tab)==RETURN_OK?1:0;
	/*  Allocate memory for the output buffer */
	tabsize = 0;
	tabcat = NULL;	/* to satisfy gcc -Wall */
	inbuf = NULL;		/* to satisfy gcc -Wall */
	if (tabflag)
	{
		/*-- If segment is a binary table, save it row by row */
		QMALLOC(outbuf, char, (larrayout = tab->naxisn[0]));
		nkey = tab->nkey;
		tabsize = larrayin = 0;
		for (j=tab->nseg; j--;)
		{
			update_tab(tab);
			/*---- Scan keys to find the reference tab and other things*/
			keytab = NULL;
			key = tab->key;
			for (k=nkey; k--; key = key->nextkey)
				if (!key->ptr)
				{
					keytab = key->tab;
					tabcat = keytab->cat;
				}
			/*---- If table contains some keys with no ptrs, we have to access a file */
			if (keytab)
			{
				QMALLOC(inbuf, char, (larrayin = keytab->naxisn[0]));
				if (open_cat(tabcat, READ_ONLY) != RETURN_OK)
					error(EXIT_FAILURE, "*Error*: Cannot access ", tabcat->filename);
				QFSEEK(tabcat->file, keytab->bodypos, SEEK_SET, tabcat->filename);
			}
			nobj = tab->naxisn[1];
			for (o=0; o<nobj; o++)
			{
				if (keytab)
					QFREAD(inbuf, larrayin, tabcat->file, tabcat->filename);
				fptr = outbuf;
				for (k=nkey; k--; key = key->nextkey)
				{
					nbytes = key->nbytes;
					ptr = key->ptr? (char *)key->ptr+nbytes*o:inbuf+key->pos;
					for (b=nbytes; b--;)
						*(fptr++) = *(ptr++);
					if (bswapflag)
						if (key->ptr)
						{
							esize = t_size[key->ttype];
							swapbytes(fptr-nbytes, esize, nbytes/esize);
						}
				}
				QFWRITE(outbuf, larrayout, cat->file, cat->filename);
			}
			if (keytab)
			{
				free(inbuf);
				if (close_cat(tabcat) != RETURN_OK)
					error(EXIT_FAILURE, "*Error*: Problem while closing",
							tabcat->filename);
			}
			tabsize += tab->tabsize;
			tab = tab->nexttab;
		}
		free(outbuf);
	}
	else
	{