/*   EXTRAITS DE LA LICENCE
	Copyright CEA, contributeurs : Luc BILLARD et Damien
	CALISTE, laboratoire L_Sim, (2001-2006)
  
	Adresse mèl :
	BILLARD, non joignable par mèl ;
	CALISTE, damien P caliste AT cea P fr.

	Ce logiciel est un programme informatique servant à visualiser des
	structures atomiques dans un rendu pseudo-3D. 

	Ce logiciel est régi par la licence CeCILL soumise au droit français et
	respectant les principes de diffusion des logiciels libres. Vous pouvez
	utiliser, modifier et/ou redistribuer ce programme sous les conditions
	de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA 
	sur le site "http://www.cecill.info".

	Le fait que vous puissiez accéder à cet en-tête signifie que vous avez 
	pris connaissance de la licence CeCILL, et que vous en avez accepté les
	termes (cf. le fichier Documentation/licence.fr.txt fourni avec ce logiciel).
*/

/*   LICENCE SUM UP
	Copyright CEA, contributors : Luc BILLARD et Damien
	CALISTE, laboratoire L_Sim, (2001-2006)

	E-mail address:
	BILLARD, not reachable any more ;
	CALISTE, damien P caliste AT cea P fr.

	This software is a computer program whose purpose is to visualize atomic
	configurations in 3D.

	This software is governed by the CeCILL  license under French law and
	abiding by the rules of distribution of free software.  You can  use, 
	modify and/ or redistribute the software under the terms of the CeCILL
	license as circulated by CEA, CNRS and INRIA at the following URL
	"http://www.cecill.info". 

	The fact that you are presently reading this means that you have had
	knowledge of the CeCILL license and that you accept its terms. You can
	find a copy of this licence shipped with this software at Documentation/licence.en.txt.
*/
#include "visuStudio.h"
#include <support.h>

subPanel* initVisuStudio()
{
  char *cl = "Define a camera path";
  char *tl = "Studio";
  char *ipn = "studio.png";
  GtkWidget *child;
  char *nR[] = {(char*)0};
  char *dR[] = {(char*)0};
  readValueOfResourceFunc rR[] = {(readValueOfResourceFunc)0};
  char *nP[] = {FLAG_PARAMETER_STUDIO_NB, (char*)0};
  char *dP[] = {DESC_PARAMETER_STUDIO_NB, (char*)0};
  readValueOfParameterFunc rP[] = {readNbPreferedNumberOfViews, (readValueOfParameterFunc)0};

  int res;

  child = createInteriorStudio();
  visuStudioData = createSubPanelWithIconFromPath(cl, tl, ipn, child,
						  (onChangePanelFunc)0,
						  (onChangePanelFunc)0);
  if (!visuStudioData)
    return (subPanel*)0;

  /* Registers the parameters and intialises their values. */
  modulePanelStudio = createVisuModuleFromValues(nP, dP, rP, nR, dR, rR, 
						 exportParametersPanelStudio,
						 (exportResourcesFunc)0);
  registeredVisuModule(modulePanelStudio);
  studio_preferedNumberOfViews = PARAMETER_STUDIO_NB_DEFAULT;


  /* Create the callbacks of all the sensitive widgets. */
/*   createCallBacksConfig(); */


  /* initialise parameters */
  res = initParametersStudio();
  if (!res)
    return (subPanel*)0;

  /* call the visu add routine */
  addSubPanel(visuStudioData);

  return visuStudioData;
}

GtkWidget *createInteriorStudio()
{
  GtkWidget *scrolledwindow1;
  GtkWidget *viewport1;
  GtkWidget *vbox1;
  GtkWidget *radioStart;
  GSList *radioStart_group = NULL;
  GtkWidget *alignment2;
  GtkWidget *hbox2;
  GtkWidget *image2;
  GtkWidget *label8;
  GtkWidget *table1;
  GtkObject *spinThetaInit_adj;
  GtkWidget *spinThetaInit;
  GtkObject *spinDxInit_adj;
  GtkWidget *spinDxInit;
  GtkObject *spinGrossInit_adj;
  GtkWidget *spinGrossInit;
  GtkObject *spinPhiInit_adj;
  GtkWidget *spinPhiInit;
  GtkObject *spinDyInit_adj;
  GtkWidget *spinDyInit;
  GtkObject *spinPerspInit_adj;
  GtkWidget *spinPerspInit;
  GtkWidget *labelHeadRotationInit;
  GtkWidget *labelHeadTranslationInit;
  GtkWidget *labelHeadScaleInit;
  GtkWidget *label9;
  GtkWidget *label10;
  GtkWidget *label11;
  GtkWidget *label12;
  GtkWidget *label13;
  GtkWidget *label14;
  GtkWidget *radioEnd;
  GtkWidget *alignment1;
  GtkWidget *hbox1;
  GtkWidget *image1;
  GtkWidget *label7;
  GtkWidget *table2;
  GtkObject *spinThetaFinal_adj;
  GtkWidget *spinThetaFinal;
  GtkObject *spinDxFinal_adj;
  GtkWidget *spinDxFinal;
  GtkObject *spinGrossFinal_adj;
  GtkWidget *spinGrossFinal;
  GtkObject *spinPhiFinal_adj;
  GtkWidget *spinPhiFinal;
  GtkObject *spinDyFinal_adj;
  GtkWidget *spinDyFinal;
  GtkObject *spinPerspFinal_adj;
  GtkWidget *spinPerspFinal;
  GtkWidget *labelHeadRotationFinal;
  GtkWidget *labelHeadTranslationFinal;
  GtkWidget *labelHeadScaleFinal;
  GtkWidget *label18;
  GtkWidget *label19;
  GtkWidget *label20;
  GtkWidget *label21;
  GtkWidget *label22;
  GtkWidget *label23;
  GtkWidget *hseparator1;
  GtkWidget *table3;
  GtkWidget *label26;
  GtkWidget *label27;
  GtkWidget *radioThetaDecr;
  GSList *radioThetaDecr_group = NULL;
  GtkWidget *radioThetaStable;
  GtkWidget *radioThetaIncr;
  GtkWidget *radioPhiDecr;
  GSList *radioPhiDecr_group = NULL;
  GtkWidget *radioPhiStable;
  GtkWidget *radioPhiIncr;
  GtkWidget *hbox4;
  GtkWidget *label28;
  GtkObject *spinbutton13_adj;
  GtkWidget *spinbutton13;
  GtkWidget *label29;
  GtkWidget *button1;
  GtkWidget *alignment3;
  GtkWidget *hbox5;
  GtkWidget *image3;
  GtkWidget *image4;
  GtkWidget *hbox6;
  GtkWidget *button2;
  GtkWidget *alignment4;
  GtkWidget *hbox7;
  GtkWidget *image5;
  GtkWidget *label30;
  GtkTooltips *tooltips;

  tooltips = gtk_tooltips_new ();

  scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (scrolledwindow1);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_SHADOW_NONE);

  viewport1 = gtk_viewport_new (NULL, NULL);
  gtk_widget_show (viewport1);
  gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (viewport1), vbox1);

  radioStart = gtk_radio_button_new (NULL);
  gtk_widget_show (radioStart);
  gtk_box_pack_start (GTK_BOX (vbox1), radioStart, FALSE, FALSE, 0);
  gtk_tooltips_set_tip (tooltips, radioStart, _("Choose the initial position with the spins or the mouse on the rendering window."), NULL);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioStart), radioStart_group);
  radioStart_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioStart));

  alignment2 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment2);
  gtk_container_add (GTK_CONTAINER (radioStart), alignment2);

  hbox2 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox2);
  gtk_container_add (GTK_CONTAINER (alignment2), hbox2);

  image2 = gtk_image_new_from_stock ("gtk-goto-first", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image2);
  gtk_box_pack_start (GTK_BOX (hbox2), image2, FALSE, FALSE, 0);

  label8 = gtk_label_new_with_mnemonic (_("initial position"));
  gtk_widget_show (label8);
  gtk_box_pack_start (GTK_BOX (hbox2), label8, FALSE, FALSE, 0);

  table1 = gtk_table_new (3, 5, FALSE);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (vbox1), table1, FALSE, TRUE, 0);

  spinThetaInit_adj = gtk_adjustment_new (40, -360, 360, 0, 10, 10);
  spinThetaInit = gtk_spin_button_new (GTK_ADJUSTMENT (spinThetaInit_adj), 1, 1);
  gtk_widget_show (spinThetaInit);
  gtk_table_attach (GTK_TABLE (table1), spinThetaInit, 2, 3, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinThetaInit), TRUE);

  spinDxInit_adj = gtk_adjustment_new (0, -3, 3, 0, 0, 0);
  spinDxInit = gtk_spin_button_new (GTK_ADJUSTMENT (spinDxInit_adj), 1, 3);
  gtk_widget_show (spinDxInit);
  gtk_table_attach (GTK_TABLE (table1), spinDxInit, 2, 3, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinDxInit), TRUE);

  spinGrossInit_adj = gtk_adjustment_new (1, 0, 10, 0, 0, 0);
  spinGrossInit = gtk_spin_button_new (GTK_ADJUSTMENT (spinGrossInit_adj), 1, 3);
  gtk_widget_show (spinGrossInit);
  gtk_table_attach (GTK_TABLE (table1), spinGrossInit, 2, 3, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinGrossInit), TRUE);

  spinPhiInit_adj = gtk_adjustment_new (-50, -360, 360, 0, 10, 10);
  spinPhiInit = gtk_spin_button_new (GTK_ADJUSTMENT (spinPhiInit_adj), 1, 1);
  gtk_widget_show (spinPhiInit);
  gtk_table_attach (GTK_TABLE (table1), spinPhiInit, 4, 5, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinPhiInit), TRUE);

  spinDyInit_adj = gtk_adjustment_new (0, -3, 3, 0, 0, 0);
  spinDyInit = gtk_spin_button_new (GTK_ADJUSTMENT (spinDyInit_adj), 1, 3);
  gtk_widget_show (spinDyInit);
  gtk_table_attach (GTK_TABLE (table1), spinDyInit, 4, 5, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinDyInit), TRUE);

  spinPerspInit_adj = gtk_adjustment_new (5, 1, 1000, 0, 10, 10);
  spinPerspInit = gtk_spin_button_new (GTK_ADJUSTMENT (spinPerspInit_adj), 1, 1);
  gtk_widget_show (spinPerspInit);
  gtk_table_attach (GTK_TABLE (table1), spinPerspInit, 4, 5, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinPerspInit), TRUE);

  labelHeadRotationInit = gtk_label_new (_("Rot."));
  gtk_widget_set_name(labelHeadRotationInit, "label_head_2");
  gtk_widget_show (labelHeadRotationInit);
  gtk_table_attach (GTK_TABLE (table1), labelHeadRotationInit, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (labelHeadRotationInit), 0, 0.5);

  labelHeadTranslationInit = gtk_label_new (_("Trans."));
  gtk_widget_set_name(labelHeadTranslationInit, "label_head_2");
  gtk_widget_show (labelHeadTranslationInit);
  gtk_table_attach (GTK_TABLE (table1), labelHeadTranslationInit, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (labelHeadTranslationInit), 0, 0.5);

  labelHeadScaleInit = gtk_label_new (_("Scale"));
  gtk_widget_set_name(labelHeadScaleInit, "label_head_2");
  gtk_widget_show (labelHeadScaleInit);
  gtk_table_attach (GTK_TABLE (table1), labelHeadScaleInit, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (labelHeadScaleInit), 0, 0.5);

  label9 = gtk_label_new (_("theta : "));
  gtk_widget_show (label9);
  gtk_table_attach (GTK_TABLE (table1), label9, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label9), 1, 0.5);

  label10 = gtk_label_new (_("dx : "));
  gtk_widget_show (label10);
  gtk_table_attach (GTK_TABLE (table1), label10, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label10), 1, 0.5);

  label11 = gtk_label_new (_("gross : "));
  gtk_widget_show (label11);
  gtk_table_attach (GTK_TABLE (table1), label11, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label11), 1, 0.5);

  label12 = gtk_label_new (_("phi : "));
  gtk_widget_show (label12);
  gtk_table_attach (GTK_TABLE (table1), label12, 3, 4, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label12), 1, 0.5);

  label13 = gtk_label_new (_("dy : "));
  gtk_widget_show (label13);
  gtk_table_attach (GTK_TABLE (table1), label13, 3, 4, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label13), 1, 0.5);

  label14 = gtk_label_new (_("persp. : "));
  gtk_widget_show (label14);
  gtk_table_attach (GTK_TABLE (table1), label14, 3, 4, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label14), 1, 0.5);

  radioEnd = gtk_radio_button_new (NULL);
  gtk_widget_show (radioEnd);
  gtk_box_pack_start (GTK_BOX (vbox1), radioEnd, FALSE, FALSE, 0);
  gtk_tooltips_set_tip (tooltips, radioEnd, _("Choose the final position with the spins or the mouse on the rendering window."), NULL);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioEnd), radioStart_group);
  radioStart_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioEnd));

  alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment1);
  gtk_container_add (GTK_CONTAINER (radioEnd), alignment1);

  hbox1 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox1);
  gtk_container_add (GTK_CONTAINER (alignment1), hbox1);

  image1 = gtk_image_new_from_stock ("gtk-goto-last", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image1);
  gtk_box_pack_start (GTK_BOX (hbox1), image1, FALSE, FALSE, 0);

  label7 = gtk_label_new_with_mnemonic (_("final position"));
  gtk_widget_show (label7);
  gtk_box_pack_start (GTK_BOX (hbox1), label7, FALSE, FALSE, 0);

  table2 = gtk_table_new (3, 5, FALSE);
  gtk_widget_show (table2);
  gtk_box_pack_start (GTK_BOX (vbox1), table2, FALSE, FALSE, 0);

  spinThetaFinal_adj = gtk_adjustment_new (40, -360, 360, 0, 10, 10);
  spinThetaFinal = gtk_spin_button_new (GTK_ADJUSTMENT (spinThetaFinal_adj), 1, 1);
  gtk_widget_show (spinThetaFinal);
  gtk_table_attach (GTK_TABLE (table2), spinThetaFinal, 2, 3, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinThetaFinal), TRUE);

  spinDxFinal_adj = gtk_adjustment_new (0, -3, 3, 0, 0, 0);
  spinDxFinal = gtk_spin_button_new (GTK_ADJUSTMENT (spinDxFinal_adj), 1, 3);
  gtk_widget_show (spinDxFinal);
  gtk_table_attach (GTK_TABLE (table2), spinDxFinal, 2, 3, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinDxFinal), TRUE);

  spinGrossFinal_adj = gtk_adjustment_new (1, 0, 10, 0, 0, 0);
  spinGrossFinal = gtk_spin_button_new (GTK_ADJUSTMENT (spinGrossFinal_adj), 1, 3);
  gtk_widget_show (spinGrossFinal);
  gtk_table_attach (GTK_TABLE (table2), spinGrossFinal, 2, 3, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinGrossFinal), TRUE);

  spinPhiFinal_adj = gtk_adjustment_new (-50, -360, 360, 0, 10, 10);
  spinPhiFinal = gtk_spin_button_new (GTK_ADJUSTMENT (spinPhiFinal_adj), 1, 1);
  gtk_widget_show (spinPhiFinal);
  gtk_table_attach (GTK_TABLE (table2), spinPhiFinal, 4, 5, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinPhiFinal), TRUE);

  spinDyFinal_adj = gtk_adjustment_new (0, -3, 3, 0, 0, 0);
  spinDyFinal = gtk_spin_button_new (GTK_ADJUSTMENT (spinDyFinal_adj), 1, 3);
  gtk_widget_show (spinDyFinal);
  gtk_table_attach (GTK_TABLE (table2), spinDyFinal, 4, 5, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinDyFinal), TRUE);

  spinPerspFinal_adj = gtk_adjustment_new (5, 1, 1000, 0, 10, 10);
  spinPerspFinal = gtk_spin_button_new (GTK_ADJUSTMENT (spinPerspFinal_adj), 1, 1);
  gtk_widget_show (spinPerspFinal);
  gtk_table_attach (GTK_TABLE (table2), spinPerspFinal, 4, 5, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinPerspFinal), TRUE);

  labelHeadRotationFinal = gtk_label_new (_("Rot."));
  gtk_widget_set_name(labelHeadRotationFinal, "label_head_2");
  gtk_widget_show (labelHeadRotationFinal);
  gtk_table_attach (GTK_TABLE (table2), labelHeadRotationFinal, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (labelHeadRotationFinal), 0, 0.5);

  labelHeadTranslationFinal = gtk_label_new (_("Trans."));
  gtk_widget_set_name(labelHeadTranslationFinal, "label_head_2");
  gtk_widget_show (labelHeadTranslationFinal);
  gtk_table_attach (GTK_TABLE (table2), labelHeadTranslationFinal, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (labelHeadTranslationFinal), 0, 0.5);

  labelHeadScaleFinal = gtk_label_new (_("Scale"));
  gtk_widget_set_name(labelHeadScaleFinal, "label_head_2");
  gtk_widget_show (labelHeadScaleFinal);
  gtk_table_attach (GTK_TABLE (table2), labelHeadScaleFinal, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (labelHeadScaleFinal), 0, 0.5);

  label18 = gtk_label_new (_("theta : "));
  gtk_widget_show (label18);
  gtk_table_attach (GTK_TABLE (table2), label18, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label18), 1, 0.5);

  label19 = gtk_label_new (_("dx : "));
  gtk_widget_show (label19);
  gtk_table_attach (GTK_TABLE (table2), label19, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label19), 1, 0.5);

  label20 = gtk_label_new (_("gross : "));
  gtk_widget_show (label20);
  gtk_table_attach (GTK_TABLE (table2), label20, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label20), 1, 0.5);

  label21 = gtk_label_new (_("phi : "));
  gtk_widget_show (label21);
  gtk_table_attach (GTK_TABLE (table2), label21, 3, 4, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label21), 1, 0.5);

  label22 = gtk_label_new (_("dy : "));
  gtk_widget_show (label22);
  gtk_table_attach (GTK_TABLE (table2), label22, 3, 4, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label22), 1, 0.5);

  label23 = gtk_label_new (_("persp. : "));
  gtk_widget_show (label23);
  gtk_table_attach (GTK_TABLE (table2), label23, 3, 4, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label23), 1, 0.5);

  hseparator1 = gtk_hseparator_new ();
  gtk_widget_show (hseparator1);
  gtk_box_pack_start (GTK_BOX (vbox1), hseparator1, TRUE, FALSE, 1);

  table3 = gtk_table_new (2, 4, FALSE);
  gtk_widget_show (table3);
  gtk_box_pack_start (GTK_BOX (vbox1), table3, FALSE, TRUE, 1);

  label26 = gtk_label_new (_("Theta : "));
  gtk_widget_set_name(label26, "label_head_2");
  gtk_widget_show (label26);
  gtk_table_attach (GTK_TABLE (table3), label26, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label26), 0, 0.5);

  label27 = gtk_label_new (_("Phi : "));
  gtk_widget_set_name(label27, "label_head_2");
  gtk_widget_show (label27);
  gtk_table_attach (GTK_TABLE (table3), label27, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label27), 0, 0.5);

  radioThetaDecr = gtk_radio_button_new_with_mnemonic (NULL, _("decrease"));
  gtk_widget_show (radioThetaDecr);
  gtk_table_attach (GTK_TABLE (table3), radioThetaDecr, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, radioThetaDecr, _("Theta turns anti trigonometric."), NULL);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioThetaDecr), radioThetaDecr_group);
  radioThetaDecr_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioThetaDecr));

  radioThetaStable = gtk_radio_button_new_with_mnemonic (NULL, _("stable"));
  gtk_widget_show (radioThetaStable);
  gtk_table_attach (GTK_TABLE (table3), radioThetaStable, 2, 3, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioThetaStable), radioThetaDecr_group);
  radioThetaDecr_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioThetaStable));

  radioThetaIncr = gtk_radio_button_new_with_mnemonic (NULL, _("increase"));
  gtk_widget_show (radioThetaIncr);
  gtk_table_attach (GTK_TABLE (table3), radioThetaIncr, 3, 4, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, radioThetaIncr, _("Theta turns trigonometric."), NULL);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioThetaIncr), radioThetaDecr_group);
  radioThetaDecr_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioThetaIncr));

  radioPhiDecr = gtk_radio_button_new_with_mnemonic (NULL, _("decrease"));
  gtk_widget_show (radioPhiDecr);
  gtk_table_attach (GTK_TABLE (table3), radioPhiDecr, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, radioPhiDecr, _("Phi turns anti trigonometric."), NULL);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioPhiDecr), radioPhiDecr_group);
  radioPhiDecr_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioPhiDecr));

  radioPhiStable = gtk_radio_button_new_with_mnemonic (NULL, _("stable"));
  gtk_widget_show (radioPhiStable);
  gtk_table_attach (GTK_TABLE (table3), radioPhiStable, 2, 3, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioPhiStable), radioPhiDecr_group);
  radioPhiDecr_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioPhiStable));

  radioPhiIncr = gtk_radio_button_new_with_mnemonic (NULL, _("increase"));
  gtk_widget_show (radioPhiIncr);
  gtk_table_attach (GTK_TABLE (table3), radioPhiIncr, 3, 4, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, radioPhiIncr, _("Phi turns trigonometric."), NULL);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioPhiIncr), radioPhiDecr_group);
  radioPhiDecr_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioPhiIncr));

  hbox4 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox4);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox4, FALSE, TRUE, 1);

  label28 = gtk_label_new (_("Let's go, play it! "));
  gtk_widget_show (label28);
  gtk_box_pack_start (GTK_BOX (hbox4), label28, TRUE, TRUE, 0);
  gtk_misc_set_alignment (GTK_MISC (label28), 1, 0.5);

  spinbutton13_adj = gtk_adjustment_new (50, 1, 1000, 5, 20, 20);
  spinbutton13 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton13_adj), 1, 0);
  gtk_widget_show (spinbutton13);
  gtk_box_pack_start (GTK_BOX (hbox4), spinbutton13, FALSE, TRUE, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton13), TRUE);

  label29 = gtk_label_new (_("steps"));
  gtk_widget_show (label29);
  gtk_box_pack_start (GTK_BOX (hbox4), label29, TRUE, TRUE, 0);
  gtk_misc_set_alignment (GTK_MISC (label29), 0, 0.5);

  button1 = gtk_button_new ();
  gtk_widget_show (button1);
  gtk_box_pack_start (GTK_BOX (hbox4), button1, FALSE, FALSE, 2);
  gtk_tooltips_set_tip (tooltips, button1, _("View it on the screen with time steps of 500ms."), NULL);

  alignment3 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment3);
  gtk_container_add (GTK_CONTAINER (button1), alignment3);

  hbox5 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox5);
  gtk_container_add (GTK_CONTAINER (alignment3), hbox5);

  image3 = create_pixmap (mainWindow, "stock_media-stop.png");
  gtk_widget_show (image3);
  gtk_box_pack_start (GTK_BOX (hbox5), image3, FALSE, FALSE, 0);

  image4 = create_pixmap (mainWindow, "stock_media-play.png");
  gtk_widget_show (image4);
  gtk_box_pack_start (GTK_BOX (hbox5), image4, FALSE, FALSE, 0);

  hbox6 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox6);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox6, FALSE, TRUE, 1);

  button2 = gtk_button_new ();
  gtk_widget_show (button2);
  gtk_box_pack_start (GTK_BOX (hbox6), button2, TRUE, FALSE, 0);

  alignment4 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment4);
  gtk_container_add (GTK_CONTAINER (button2), alignment4);

  hbox7 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox7);
  gtk_container_add (GTK_CONTAINER (alignment4), hbox7);

  image5 = gtk_image_new_from_stock ("gtk-save-as", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image5);
  gtk_box_pack_start (GTK_BOX (hbox7), image5, FALSE, FALSE, 0);

  label30 = gtk_label_new_with_mnemonic (_("Dump all steps"));
  gtk_widget_show (label30);
  gtk_box_pack_start (GTK_BOX (hbox7), label30, FALSE, FALSE, 0);

  return scrolledwindow1;
}
int initParametersStudio()
{
/*   int nbParametersStudio = 1; */
/*   char* namesStudio[] = {"studio_preferedNumberOfViews", (char*)0}; */
/*   char* commentaries[] = {"Number of generated steps ; integer > 0", (char*)0}; */
/*   int i; */
/*   char *buffer; */

/*   visuStudioData->parametersNames = */
/*     malloc(sizeof(char*) * (nbParametersStudio + 1)); */
/*   visuStudioData->parametersCommentaries = g_hash_table_new(g_str_hash, g_str_equal); */
/*   if (!visuStudioData->parametersNames || !visuStudioData->parametersCommentaries) */
/*     { */
/*       allocationProblems(); */
/*       return 0; */
/*     } */
/*   for (i = 0; namesStudio[i]; i++) */
/*     { */
/*       visuStudioData->parametersNames[i] = malloc(sizeof(char) * */
/* 						  (strlen(namesStudio[i]) + 1)); */
/*       buffer = malloc(sizeof(char) * (strlen(commentaries[i]) + 1)); */
/*       if (!visuStudioData->parametersNames[i] || !buffer) */
/* 	{ */
/* 	  allocationProblems(); */
/* 	  return 0; */
/* 	} */
/*       strcpy(visuStudioData->parametersNames[i], namesStudio[i]); */
/*       strcpy(buffer, commentaries[i]); */
/*       g_hash_table_insert(visuStudioData->parametersCommentaries, */
/* 			  (gpointer)namesStudio[i], (gpointer)buffer); */
/*     } */
/*   visuStudioData->parametersNames[nbParametersStudio] = (char*)0; */

/*   sprintf(exchangeBuffer, "%d", studio_preferedNumberOfViews_default); */
/*   putParameterValueStudio("studio_preferedNumberOfViews", exchangeBuffer); */

  return 1;
}



/********************/
/* In/Out functions */
/********************/

/* retrieve a string corresponding to the value of a parameter. */
char* getParameterValueStudio(const char* paramName)
{
  if (!strcmp(paramName, "studio_preferedNumberOfViews"))
    {
      sprintf(exchangeBuffer, "%5d", studio_preferedNumberOfViews);
      return exchangeBuffer;
    }
  else
    return (char*)0;
}
/* Read the string paramValue and put the result in the parameter
   define by paramName. It return 0 if a read error occurs and 1 otherwise.*/
int putParameterValueStudio(const char* paramName, const char* paramValue)
{
  int res;
  int tmpInt;

  if (!strcmp(paramName, "studio_preferedNumberOfViews"))
    {
      res = sscanf(paramValue, "%d", &tmpInt);
      if (res)
	{
	  if (tmpInt <= 0)
	    {
	      fprintf(stderr,"PARSE ERROR! Parameter 'studio_preferedNumberOfViews' must be scrict greater than 0.\n");
	      return 0;
	    }
	  studio_preferedNumberOfViews = tmpInt;
	  return 1;
	}
      else
	return 0;
    }
  else
    return 0;
}

/* This function details how to read the preferedNumberOfViews
   parameter. */
int readNbPreferedNumberOfViews(char* value, VisuIO *io, gpointer userData)
{
  int res;

  res = sscanf(value,"%d", &studio_preferedNumberOfViews);
  if (res != 1 || studio_preferedNumberOfViews <= 0)
    {
      g_string_append_printf(io->informations, "WARNING! Parse error at line %d,"
			     " 1 integer point values (v > 0) must appear after"
			     " the %s markup.\n", *io->nbLine, FLAG_PARAMETER_STUDIO_NB);
      studio_preferedNumberOfViews = PARAMETER_STUDIO_NB_DEFAULT;
      return 1;
    }
  return 0;
}
/* These functions write all the element list to export there associated resources. */
void exportParametersPanelStudio(VisuIO *io)
{
  int res;
  
  res = fprintf(*io->flux, "# %s\n", DESC_PARAMETER_STUDIO_NB);
  if (!res)
    return;
  fprintf(*io->flux, "%s: %d\n\n", FLAG_PARAMETER_STUDIO_NB, studio_preferedNumberOfViews);
  *(io->nbLine) += 3;
}
