Logo Search packages:      
Sourcecode: gamgi version File versions  Download package

gamgi_gtk_cell_modify.c

/***********************************************
 *
 * $GAMGI/src/gtk/cell/gamgi_gtk_cell_modify.c
 *
 * Copyright (C) 2004 Carlos Pereira
 *
 * Distributed under the terms of the GNU
 * General Public License: $GAMGI/LICENSE
 *
 */

#include "gamgi_engine.h"
#include "gamgi_gtk.h"
#include "gamgi_mesa.h"
#include "gamgi_math.h"
#include "gamgi_phys.h"
#include "gamgi_global.h"

#include "gamgi_engine_find.h"
#include "gamgi_gtk_dialog.h"
#include "gamgi_gtk_cell_symmetry.h"
#include "gamgi_gtk_cell_align.h"
#include "gamgi_gtk_history.h"
#include "gamgi_gtk_object.h"
#include "gamgi_gtk_statusbar.h"
#include "gamgi_mesa_center.h"
#include "gamgi_mesa_translate.h"
#include "gamgi_mesa_rotate.h"
#include "gamgi_mesa_select.h"
#include "gamgi_math_vector.h"
#include "gamgi_math_matrix.h"
#include "gamgi_math_quaternion.h"
#include "gamgi_math_euler.h"
#include "gamgi_math_node.h"
#include "gamgi_math_position.h"
#include "gamgi_phys_cell.h"
#include "gamgi_io_token.h"

/*************** internal function *****************
 *                                                 *
 *                STATIC_ABSOLUTE                  *
 *                                                 *
 * Set origin and angle reading modes to absolute. *
 ***************************************************/

static void static_absolute (GtkWidget *dialog)
{
GtkWidget *button;

button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_translation_absolute");
gtk_button_clicked (GTK_BUTTON (button));
button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_rotation_absolute");
gtk_button_clicked (GTK_BUTTON (button));
}

/***************** internal function ***************
 *                                                 *
 *                   STATIC_RELATIVE               *
 *                                                 *
 * Set origin and angle reading modes to relative. *
 ***************************************************/

static void static_relative (GtkWidget *dialog)
{
GtkWidget *button;

button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_translation_relative");
gtk_button_clicked (GTK_BUTTON (button));
button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_rotation_relative");
gtk_button_clicked (GTK_BUTTON (button));
}

/***************** internal function ***************
 *                                                 *
 *               STATIC_TRANSLATION_CLEAN          *
 *                                                 *
 * Reset the origin entries everytime the absolute *
 * or relative origin buttons are toggled.         *
 *                                                 *
 ***************************************************/

static void static_translation_clean (GtkWidget *widget, void *data)
{
gamgi_window *window = GAMGI_CAST_WINDOW data;
GtkWidget *dialog = window->dialog0;
GtkWidget *entry;

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_x");
gtk_entry_set_text (GTK_ENTRY (entry), "");
entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_y");
gtk_entry_set_text (GTK_ENTRY (entry), "");
entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_z");
gtk_entry_set_text (GTK_ENTRY (entry), "");
}

/***************** internal function **************
 *                                                *
 *                STATIC_ROTATION_CLEAN           *
 *                                                *
 * Reset the angle entries everytime the absolute *
 * or relative angle buttons are toggled.         *
 *                                                *
 **************************************************/

static void static_rotation_clean (GtkWidget *widget, void *data)
{
gamgi_window *window = GAMGI_CAST_WINDOW data;
GtkWidget *dialog = window->dialog0;
GtkWidget *entry;

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_e1");
gtk_entry_set_text (GTK_ENTRY (entry), "");
entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_e2");
gtk_entry_set_text (GTK_ENTRY (entry), "");
entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_e3");
gtk_entry_set_text (GTK_ENTRY (entry), "");
}

static void static_vectors (GtkWidget *widget, void *data)
{
gamgi_window *window = GAMGI_CAST_WINDOW data;
GtkWidget *dialog = window->dialog0;
GtkWidget *combo;
gamgi_enum lattice, vectors;
int row;

/************************************************************
 *                          update o4                       *
 *                                                          *
 * Conventional vectors: get lattice, update accordingly    *
 * Primitive vectors: disable centered items, set o4 to 000 *
 * Local vectors: enable centered items, set o4 to Local    *
 ************************************************************/

row = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));

if (row == GAMGI_PHYS_CONVENTIONAL - 1)
  {
  vectors = GAMGI_PHYS_CONVENTIONAL;
  lattice = gamgi_gtk_cell_symmetry_lattice (dialog);
  }

else if (row == GAMGI_PHYS_PRIMITIVE - 1)
  {
  vectors = GAMGI_PHYS_PRIMITIVE;
  lattice = GAMGI_PHYS_CUBIC_P;
  combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_o4");
  gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
  }

else
  {
  vectors = GAMGI_PHYS_CONVENTIONAL;
  lattice = gamgi_gtk_cell_symmetry_lattice (dialog);
  combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_o4");
  gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 7);
  }

gamgi_gtk_cell_symmetry_nodes (lattice, vectors, dialog);
}

static void static_faces (GtkWidget *widget, void *data)
{
gamgi_window *window = GAMGI_CAST_WINDOW data;
GtkWidget *dialog = window->dialog0;
GtkWidget *option_menu, *menu;
GtkWidget *item_now;
GtkWidget *item_faces_yes, *item_all;
GtkWidget *item_parallelepiped, *item_sphere, *item_projection;

/*************************
 * get faces option menu *
 *************************/

option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_faces");
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
item_now = gtk_menu_get_active (GTK_MENU (menu));

item_faces_yes = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_faces_yes");
item_all = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_all");

if (item_now == item_faces_yes)
  {
  /***************************
   * get borders option menu *
   ***************************/

  option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_borders");
  menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
  item_now = gtk_menu_get_active (GTK_MENU (menu));
  
  /******************
   * disable widget *
   ******************/

  if (item_now == item_all)
    gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), GAMGI_PHYS_FACES - 1);

  gtk_widget_set_sensitive (item_all, FALSE);
  }
else
  {
  /************************
   * get type option menu *
   ************************/

  option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_type");
  menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
  item_now = gtk_menu_get_active (GTK_MENU (menu));

  item_parallelepiped = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_parallelepiped");
  item_sphere = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_sphere");
  item_projection = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_projection");

  /*****************
   * enable widget *
   *****************/

  option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_type");
  menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
  item_now = gtk_menu_get_active (GTK_MENU (menu));

  if (item_now != item_parallelepiped && item_now != item_sphere 
  && item_now != item_projection)
    gtk_widget_set_sensitive (item_all, TRUE);
  }
}

static void static_type (GtkWidget *widget, void *data)
{
gamgi_window *window = GAMGI_CAST_WINDOW data;
GtkWidget *dialog = window->dialog0;
GtkWidget *entry_n1, *entry_n2, *entry_n3;
GtkWidget *label_n1, *label_n2, *label_n3;
GtkWidget *entry_v1, *entry_v2, *entry_v3;
GtkWidget *label_v1, *label_v2, *label_v3;
GtkWidget *entry_v12, *entry_v13, *entry_v23;
GtkWidget *label_v12, *label_v13, *label_v23;
GtkWidget *option_menu, *menu;
GtkWidget *item_faces, *item_faces_yes;
GtkWidget *item_borders, *item_borders_all;
GtkWidget *item_borders_faces, *item_borders_none;
GtkWidget *item_type, *item_type_local;
GtkWidget *item_parallelepiped, *item_sphere, *item_projection;
GtkWidget *vbox_faces, *vbox_nodes;
char token[GAMGI_ENGINE_TOKEN];
const char *name;

/*****************
 * get type data *
 *****************/

option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_type");
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
item_type = gtk_menu_get_active (GTK_MENU (menu));

item_parallelepiped = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_parallelepiped");
item_sphere = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_sphere");
item_projection = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_projection");
item_type_local = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_type_local");

/****************************
 * set n1, n2, n3 menuitems *
 ****************************/

entry_n1 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_n1");
entry_n2 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_n2");
entry_n3 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_n3");

label_n1 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_n1");
label_n2 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_n2");
label_n3 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_n3");

/**********************
 * initialize widgets *
 **********************/

if (item_type == item_parallelepiped
|| item_type == item_sphere
|| item_type == item_projection
|| item_type == item_type_local)
  {
  gtk_entry_set_text (GTK_ENTRY (entry_n1), "");
  gtk_entry_set_text (GTK_ENTRY (entry_n2), "");
  gtk_entry_set_text (GTK_ENTRY (entry_n3), "");
  }
else
  {
  name = gtk_entry_get_text (GTK_ENTRY (entry_n1));
  if (gamgi_io_token_check (name) == FALSE)
    {
    sprintf (token, "%d", GAMGI_PHYS_CELL_N1);
    gtk_entry_set_text (GTK_ENTRY (entry_n1), token);
    }
  name = gtk_entry_get_text (GTK_ENTRY (entry_n2));
  if (gamgi_io_token_check (name) == FALSE)
    {
    sprintf (token, "%d", GAMGI_PHYS_CELL_N2);
    gtk_entry_set_text (GTK_ENTRY (entry_n2), token);
    }
  name = gtk_entry_get_text (GTK_ENTRY (entry_n3));
  if (gamgi_io_token_check (name) == FALSE)
    {
    sprintf (token, "%d", GAMGI_PHYS_CELL_N3);
    gtk_entry_set_text (GTK_ENTRY (entry_n3), token);
    }
  }

if (item_type != item_parallelepiped
&& item_type != item_sphere
&& item_type != item_projection)
  {
  /******************
   * enable widgets *
   ******************/

  gtk_widget_set_sensitive (label_n1, TRUE);
  gtk_widget_set_sensitive (label_n2, TRUE);
  gtk_widget_set_sensitive (label_n3, TRUE);

  gtk_widget_set_sensitive (entry_n1, TRUE);
  gtk_widget_set_sensitive (entry_n2, TRUE);
  gtk_widget_set_sensitive (entry_n3, TRUE);
  }
else
  {
  /*******************
   * disable widgets *
   *******************/

  gtk_widget_set_sensitive (entry_n1, FALSE);
  gtk_widget_set_sensitive (entry_n2, FALSE);
  gtk_widget_set_sensitive (entry_n3, FALSE);

  gtk_widget_set_sensitive (label_n1, FALSE);
  gtk_widget_set_sensitive (label_n2, FALSE);
  gtk_widget_set_sensitive (label_n3, FALSE);
  }

/*******************
 * set v1 menuitem *
 *******************/

entry_v1 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v1");
label_v1 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_v1");

/*********************
 * initialize widget *
 *********************/

if (item_type != item_parallelepiped
&& item_type != item_sphere)
  gtk_entry_set_text (GTK_ENTRY (entry_v1), "");

if (item_type == item_parallelepiped
|| item_type == item_sphere
|| item_type == item_type_local)
  {
  /*****************
   * enable widget *
   *****************/

  gtk_widget_set_sensitive (label_v1, TRUE);
  gtk_widget_set_sensitive (entry_v1, TRUE);
  }
else
  {
  /******************
   * disable widget *
   ******************/

  gtk_widget_set_sensitive (entry_v1, FALSE);
  gtk_widget_set_sensitive (label_v1, FALSE);
  }

/***************************************
 * set v2, v3, v12, v13, v23 menuitems *
 ***************************************/

entry_v2 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v2");
entry_v3 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v3");
entry_v12 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v12");
entry_v13 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v13");
entry_v23 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v23");

label_v2 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_v2");
label_v3 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_v3");
label_v12 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_v12");
label_v13 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_v13");
label_v23 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_v23");

/**********************
 * initialize widgets *
 **********************/

if (item_type != item_parallelepiped)
  {
  gtk_entry_set_text (GTK_ENTRY (entry_v2), "");
  gtk_entry_set_text (GTK_ENTRY (entry_v3), "");
  gtk_entry_set_text (GTK_ENTRY (entry_v12), "");
  gtk_entry_set_text (GTK_ENTRY (entry_v13), "");
  gtk_entry_set_text (GTK_ENTRY (entry_v23), "");
  }

if (item_type == item_parallelepiped
|| item_type == item_type_local)
  {
  /******************
   * enable widgets *
   ******************/

  gtk_widget_set_sensitive (label_v2, TRUE);
  gtk_widget_set_sensitive (label_v3, TRUE);
  gtk_widget_set_sensitive (label_v12, TRUE);
  gtk_widget_set_sensitive (label_v13, TRUE);
  gtk_widget_set_sensitive (label_v23, TRUE);

  gtk_widget_set_sensitive (entry_v2, TRUE);
  gtk_widget_set_sensitive (entry_v3, TRUE);
  gtk_widget_set_sensitive (entry_v12, TRUE);
  gtk_widget_set_sensitive (entry_v13, TRUE);
  gtk_widget_set_sensitive (entry_v23, TRUE);
  }
else
  {
  /*******************
   * disable widgets *
   *******************/

  gtk_widget_set_sensitive (entry_v2, FALSE);
  gtk_widget_set_sensitive (entry_v3, FALSE);
  gtk_widget_set_sensitive (entry_v12, FALSE);
  gtk_widget_set_sensitive (entry_v13, FALSE);
  gtk_widget_set_sensitive (entry_v23, FALSE);

  gtk_widget_set_sensitive (label_v2, FALSE);
  gtk_widget_set_sensitive (label_v3, FALSE);
  gtk_widget_set_sensitive (label_v12, FALSE);
  gtk_widget_set_sensitive (label_v13, FALSE);
  gtk_widget_set_sensitive (label_v23, FALSE);
  }

/******************
 * set nodes menu *
 ******************/

vbox_nodes = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "vbox_nodes");
option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_nodes");

if (item_type != item_projection)
  {
  /******************
   * enable widgets *
   ******************/

  gtk_widget_set_sensitive (vbox_nodes, TRUE);
  }
else
  {
  /*******************
   * disable widgets *
   *******************/

  gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), FALSE);
  gtk_widget_set_sensitive (vbox_nodes, FALSE);
  }

/******************
 * set faces menu *
 ******************/

vbox_faces = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "vbox_faces");
option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_faces");
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
item_faces = gtk_menu_get_active (GTK_MENU (menu));

if (item_type != item_parallelepiped
&& item_type != item_sphere
&& item_type != item_projection)
  {
  /******************
   * enable widgets *
   ******************/

  gtk_widget_set_sensitive (vbox_faces, TRUE);
  }
else
  {
  /*******************
   * disable widgets *
   *******************/

  gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), FALSE);
  gtk_widget_set_sensitive (vbox_faces, FALSE);
  }

/***************************
 * get borders, faces data *
 ***************************/

option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_borders");
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
item_borders = gtk_menu_get_active (GTK_MENU (menu));

item_borders_all = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_all");
item_borders_faces = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_faces");
item_borders_none = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_none");

item_faces_yes = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_faces_yes");

/***************************
 * set all,faces menuitems *
 ***************************/

if (item_type == item_parallelepiped 
|| item_type == item_sphere
|| item_type == item_projection)
  {
  /*******************
   * disable widgets *
   *******************/

  if (item_borders == item_borders_all
  || item_borders == item_borders_faces)
    gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), GAMGI_PHYS_EDGES - 1);

  gtk_widget_set_sensitive (item_borders_all, FALSE);
  gtk_widget_set_sensitive (item_borders_faces, FALSE);
  }
else
  {
  /******************
   * enable widgets *
   ******************/

  if (item_faces != item_faces_yes)
    gtk_widget_set_sensitive (item_borders_all, TRUE);
  gtk_widget_set_sensitive (item_borders_faces, TRUE);
  }

/*********************
 * set none menuitem *
 *********************/

if (item_type == item_projection)
  {
  /******************
   * disable widget *
   ******************/

  if (item_borders == item_borders_none)
    gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), GAMGI_PHYS_EDGES - 1);

  gtk_widget_set_sensitive (item_borders_none, FALSE);
  }
else
  {
  /*****************
   * enable widget *
   *****************/

  gtk_widget_set_sensitive (item_borders_none, TRUE);
  }

}

static void static_button (GtkWidget *dialog, char *string)
{
GtkWidget *button;

button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), string);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
}

/******************** internal function ****************
 *                                                     *
 *                       STATIC_SWITCH                 *
 *                                                     *
 *                                                     *
 *******************************************************/

static void static_switch (GtkNotebook *notebook,
GtkNotebookPage *page, int tag, void *data)
{
gamgi_window *window = GAMGI_CAST_WINDOW data;
GtkWidget *dialog = window->dialog0;

if (window->dialog1 != NULL)
  {
  /*********************************************************
   * close second level dialogs when notebook page changes *
   *********************************************************/

  static_button (dialog, "button_system");
  static_button (dialog, "button_lattice");
  static_button (dialog, "button_group");

  static_button (dialog, "button_translation");
  static_button (dialog, "button_rotation");
  }

}

/******************** internal function ****************
 *                                                     *
 *                       STATIC_RESET                  *
 *                                                     *
 * Reset the cell modify dialog, cleaning all entries. *
 *                                                     *
 *******************************************************/

static void static_reset (gamgi_window *window)
{
GtkWidget *dialog = window->dialog0;
GtkWidget *option_menu;
GtkWidget *entry;
GtkWidget *vbox;
GtkWidget *combo;

/*******************
 * clean Cell name *
 *******************/

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_cell");
gtk_entry_set_text (GTK_ENTRY (entry), "");

/***********************************************************
 * clean symmetry: System, Lattice, Group, Lengths, Angles *
 ***********************************************************/

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_system");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_lattice");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_group");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_a");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_b");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_c");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_ab");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_ac");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_bc");
gtk_entry_set_text (GTK_ENTRY (entry), "");

/*************************************************
 * clean Type page: Type, Cells, Lengths, Angles *
 *************************************************/

option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_type");
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), 6);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_n1");
gtk_widget_set_sensitive (entry, TRUE);
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_n2");
gtk_widget_set_sensitive (entry, TRUE);
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_n3");
gtk_widget_set_sensitive (entry, TRUE);
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v1");
gtk_widget_set_sensitive (entry, TRUE);
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v2");
gtk_widget_set_sensitive (entry, TRUE);
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v3");
gtk_widget_set_sensitive (entry, TRUE);
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v12");
gtk_widget_set_sensitive (entry, TRUE);
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v13");
gtk_widget_set_sensitive (entry, TRUE);
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v23");
gtk_widget_set_sensitive (entry, TRUE);
gtk_entry_set_text (GTK_ENTRY (entry), "");

/***********************
 * clean Position page *
 ***********************/

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_x");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_y");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_z");
gtk_entry_set_text (GTK_ENTRY (entry), "");

/***********************
 * clean Rotation page *
 ***********************/

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_e1");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_e2");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_e3");
gtk_entry_set_text (GTK_ENTRY (entry), "");

/*********************
 * clean Origin page *
 *********************/

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_o1");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_o2");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_o3");
gtk_entry_set_text (GTK_ENTRY (entry), "");

combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_o4");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 7);

combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_origin_vectors");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 2);

combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_axes");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 2);

combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_axes_vectors");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 2);

/*********************************************************
 * clean View page: Borders, Faces, Nodes, Color, Scale  *
 *                                                       *
 * enable the vboxes first THEN update the option_menus! *
 *********************************************************/

option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_borders");
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), 4);

vbox = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "vbox_faces");
gtk_widget_set_sensitive (vbox, TRUE);
option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_faces");
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), 2);

vbox = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "vbox_nodes");
gtk_widget_set_sensitive (vbox, TRUE);
option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_nodes");
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), 2);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_red");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_green");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_blue");
gtk_entry_set_text (GTK_ENTRY (entry), "");

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_scale");
gtk_entry_set_text (GTK_ENTRY (entry), "");

static_type (NULL, window);
}

/************ internal function ************
 *                                         *
 *               STATIC_GLOBAL             *
 *                                         *
 * Makes the cell entry sensitive when the *
 * local button is pressed and insensitive *
 * when the global button is pressed.      *
 *                                         *
 *******************************************/

static void static_global (GtkWidget *widget, void *data)
{
gamgi_window *window = GAMGI_CAST_WINDOW data;
GtkWidget *dialog = window->dialog0;
GtkWidget *hbox, *button;

hbox = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "hbox_cell");
button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_global");

if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) == FALSE)
  {
  /****************************
   * Choose the Cell directly *
   ****************************/

  gtk_widget_set_sensitive (hbox, TRUE);
  static_absolute (dialog);
  }
else
  {
  /********************************************
   * Choose the Cell List previously selected *
   ********************************************/

  gtk_widget_set_sensitive (hbox, FALSE);
  static_reset (window);
  static_relative (dialog);
  }
}

static void static_ok (GtkWidget *widget, void *data)
{
gamgi_window *window = GAMGI_CAST_WINDOW data;
gamgi_cell *cell;
GtkWidget *dialog = window->dialog0;
GtkWidget *option_menu, *menu;
GtkWidget *item, *item_now;
GtkWidget *button;
GtkWidget *combo;
GtkEntry *entry;
char token[GAMGI_ENGINE_TOKEN];
const char *name_system, *name_lattice, *name_group;
const char *name;
double euler_old[3], origin_old[3];
double euler[3], origin[3];
double zero[3];
double a, b, c, ab, ac, bc;
double v1, v2, v3, v12, v13, v23;
double scale;
float red, green, blue;
int n1, n2, n3;
int o1, o2, o3;
gamgi_enum o4;
gamgi_enum origin_vectors, axes_vectors;
gamgi_bool axes;
int lattice, group;
int type, borders, nodes, faces;
int row;

button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_global");
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) == FALSE)
  {
  /****************
   * Local method *
   ****************/

  /**************************************
   * Get name (possibly new) and number *
   **************************************/

  cell = GAMGI_CAST_CELL gamgi_gtk_object_number (dialog,
  "entry_cell", GAMGI_ENGINE_CELL, window, token);
  if (cell == NULL)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Cell Object", window);
    return;
    }

  /**************************
   * get initial parameters *
   **************************/

  lattice = cell->lattice;
  group = cell->group;
  a = 0.0;
  b = 0.0;
  c = 0.0;
  ab = 0.0;
  ac = 0.0;
  bc = 0.0;

  type = cell->type;
  n1 = cell->n1;
  n2 = cell->n2;
  n3 = cell->n3;
  v1 = cell->v1;
  v2 = cell->v2;
  v3 = cell->v3;
  v12 = cell->v12;
  v13 = cell->v13;
  v23 = cell->v23;

  if (cell->origin_vectors == GAMGI_PHYS_CONVENTIONAL)
    gamgi_math_node_conventional (cell->lattice,
    cell->o1, cell->o2, cell->o3, &o1, &o2, &o3, &o4);
  else
    { o1 = cell->o1; o2 = cell->o2; o3 = cell->o3; o4 = FALSE; }
  origin_vectors = cell->origin_vectors;
  axes = cell->axes;
  axes_vectors = cell->axes_vectors;

  borders = cell->borders;
  faces = cell->faces;
  nodes = cell->nodes;
  red = cell->red;
  green = cell->green;
  blue = cell->blue;
  scale = cell->object.scale;

  /***************************************
   * get Bravais lattice and space group *
   ***************************************/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_system");
  name_system = gtk_entry_get_text (entry);
  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_lattice");
  name_lattice = gtk_entry_get_text (entry);
  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_group");
  name_group = gtk_entry_get_text (entry);

  if ((gamgi_io_token_check (name_system) == TRUE
  || gamgi_io_token_check (name_lattice) == TRUE
  || gamgi_io_token_check (name_group) == TRUE)
  && gamgi_gtk_cell_symmetry_create (&lattice, &group, window) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Symmetry Data", window);
    return;
    }

  /*****
   * a *
   *****/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_a");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE && 
  gamgi_io_token_double_scan (name, &a, GAMGI_MATH_TOLERANCE_LENGTH, DBL_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Parameter Data", window);
    return;
    }

  /*****
   * b *
   *****/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_b");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE && 
  gamgi_io_token_double_scan (name, &b, GAMGI_MATH_TOLERANCE_LENGTH, DBL_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Parameter Data", window);
    return;
    }

  /*****
   * c *
   *****/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_c");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE && 
  gamgi_io_token_double_scan (name, &c, GAMGI_MATH_TOLERANCE_LENGTH, DBL_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Parameter Data", window);
    return;
    }

  /******
   * ab *
   ******/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_ab");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE && 
  gamgi_io_token_double_scan (name, &ab, GAMGI_MATH_TOLERANCE_ANGLE, 180.0) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Parameter Data", window);
    return;
    }

  /******
   * ac *
   ******/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_ac");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE && 
  gamgi_io_token_double_scan (name, &ac, GAMGI_MATH_TOLERANCE_ANGLE, 180.0) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Parameter Data", window);
    return;
    }

  /******
   * bc *
   ******/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_bc");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE && 
  gamgi_io_token_double_scan (name, &bc, GAMGI_MATH_TOLERANCE_ANGLE, 180.0) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Parameter Data", window);
    return;
    } 

  /*****************************************
   * check and complete lattice parameters *
   *****************************************/

  if (gamgi_gtk_cell_symmetry_parameters (cell, lattice, &a, &b, &c, &ab, &ac, &bc) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Parameter Data", window);
    return;
    }

  /******************
   * Get old origin *
   ******************/

  gamgi_math_position_cell_translation_get (cell, origin_old);

  /******************
   * Get new origin *
   ******************/

  button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_translation_absolute");
  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) == TRUE)
    {
    /****************************************************
     * Absolute move: the default is the current origin *
     ****************************************************/

    gamgi_math_vector_copy (origin_old, origin);
    }
  else
    {
    /**************************************
     * Relative move: the default is zero *
     **************************************/

    gamgi_math_vector_zero (origin);
    }

  /*****
   * x *
   *****/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_x");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE && 
  gamgi_io_token_double_scan (name, &origin[0], -DBL_MAX, DBL_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Position Data", window);
    return;
    }

  /*****
   * y *
   *****/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_y");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE && 
  gamgi_io_token_double_scan (name, &origin[1], -DBL_MAX, DBL_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Position Data", window);
    return;
    }

  /*****
   * z *
   *****/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_z");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE && 
  gamgi_io_token_double_scan (name, &origin[2], -DBL_MAX, DBL_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Position Data", window);
    return;
    }

  /*****************
   * Get old angle *
   *****************/

  gamgi_math_position_cell_rotation_get (cell, euler_old);

  /*****************
   * Get new angle *
   *****************/

  button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_rotation_absolute");
  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) == TRUE)
    {
    /****************************************************
     * Absolute angle: the default is the current angle *
     ****************************************************/

    gamgi_math_vector_copy (euler_old, euler);
    }
  else
    {
    /**************************************
     * Relative move: the default is zero *
     **************************************/

    gamgi_math_vector_zero (euler);
    }

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_e1");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_double_scan (name, &euler[0], 0.0, 180.0) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Angle Data", window);
    return;
    }

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_e2");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_double_scan (name, &euler[1], 0.0, 360.0) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Angle Data", window);
    return;
    }

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_e3");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_double_scan (name, &euler[2], 0.0, 360.0) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Angle Data", window);
    return;
    }

  /************************
   * get type option menu *
   ************************/

  option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_type");
  menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
  item_now = gtk_menu_get_active (GTK_MENU (menu));

  /**********************
   * get type menu item *
   **********************/

  item = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_conventional");
  if (item == item_now) type = GAMGI_PHYS_CONVENTIONAL;

  item = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_primitive");
  if (item == item_now) type = GAMGI_PHYS_PRIMITIVE;

  item = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_wigner");
  if (item == item_now) type = GAMGI_PHYS_WIGNER;

  item = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_parallelepiped");
  if (item == item_now) type = GAMGI_PHYS_PARALLELEPIPED;

  item = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_sphere");
  if (item == item_now) type = GAMGI_PHYS_SPHERE;

  item = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_projection");
  if (item == item_now) type = GAMGI_PHYS_PROJECTION;

  if (type == GAMGI_PHYS_WIGNER && (lattice == GAMGI_PHYS_TRICLINIC_P ||
  lattice == GAMGI_PHYS_MONOCLINIC_P || lattice == GAMGI_PHYS_MONOCLINIC_C))
    {
    gamgi_gtk_dialog_message_create ("Error", "Sorry, not supported yet", window);
    return;
    }

  /******
   * n1 *
   ******/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_n1");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_int_scan (name, &n1, 1, INT_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid volume parameters", window);
    return;
    }

  /******
   * n2 *
   ******/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_n2");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_int_scan (name, &n2, 1, INT_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid volume parameters", window);
    return;
    }

  /******
   * n3 *
   ******/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_n3");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_int_scan (name, &n3, 1, INT_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid volume parameters", window);
    return;
    }

  /******
   * v1 *
   ******/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_v1");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_double_scan (name, &v1, GAMGI_MATH_TOLERANCE_LENGTH, DBL_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid volume parameters", window);
    return;
    }

  /******
   * v2 *
   ******/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_v2");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_double_scan (name, &v2, GAMGI_MATH_TOLERANCE_LENGTH, DBL_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid volume parameters", window);
    return;
    }

  /******
   * v3 *
   ******/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_v3");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_double_scan (name, &v3, GAMGI_MATH_TOLERANCE_LENGTH, DBL_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid volume parameters", window);
    return;
    }

  /*******
   * v12 *
   *******/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_v12");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_double_scan (name, &v12, GAMGI_MATH_TOLERANCE_ANGLE, 180.0) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid volume parameters", window);
    return;
    }

  /*******
   * v13 *
   *******/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_v13");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_double_scan (name, &v13, GAMGI_MATH_TOLERANCE_ANGLE, 180.0) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid volume parameters", window);
    return;
    }

  /*******
   * v23 *
   *******/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_v23");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_double_scan (name, &v23, GAMGI_MATH_TOLERANCE_ANGLE, 180.0) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid volume parameters", window);
    return;
    }

  if (type == GAMGI_PHYS_PARALLELEPIPED)
    {
    /*********************************************************
     * the 3 angles together cannot be too close to 0 or 360 *
     *                                                       *
     * each angle cannot be larger than the sum of the other *
     * two, or smaller than the difference of the other two  *
     *********************************************************/

     if (cell->v12 + cell->v13 + cell->v23 > 360.0 - GAMGI_MATH_TOLERANCE_ANGLE)
      {
      gamgi_gtk_dialog_message_create ("Error", "Invalid volume parameters", window);
      return;
      }

    if (v12 + GAMGI_MATH_TOLERANCE_ANGLE > v13 + v23
    || v13 + GAMGI_MATH_TOLERANCE_ANGLE > v12 + v23 
    || v23 + GAMGI_MATH_TOLERANCE_ANGLE > v12 + v13)
      {
      gamgi_gtk_dialog_message_create ("Error", "Invalid volume parameters", window);
      return;
      }

    if (v12 - GAMGI_MATH_TOLERANCE_ANGLE < abs (v13 - v23) 
    || v13 - GAMGI_MATH_TOLERANCE_ANGLE < abs (v12 - v23) 
    || v23 - GAMGI_MATH_TOLERANCE_ANGLE < abs (v12 - v13))
      {
      gamgi_gtk_dialog_message_create ("Error", "Invalid volume parameters", window);
      return;
      }

    }

  /******************
   * get o1, o2, o3 *
   ******************/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_o1");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_int_scan (name, &o1, -INT_MAX, INT_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Origin Node Data", window);
    return;
    }

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_o2");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_int_scan (name, &o2, -INT_MAX, INT_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Origin Node Data", window);
    return;
    }

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_o3");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_int_scan (name, &o3, -INT_MAX, INT_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Origin Node Data", window);
    return;
    }

  /**********************
   * get origin_vectors *
   **********************/

  combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_origin_vectors");
  row = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
  if (row != 2) origin_vectors = row + 1;

  /**********
   * get o4 *
   **********/

  combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_o4");
  row = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
  if (row != 7) o4 = row;

  if (o4 != FALSE && origin_vectors == GAMGI_PHYS_PRIMITIVE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Origin Node Data", window);
    return;
    }

  if (o4 != FALSE && gamgi_math_node_check (lattice, o4) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Origin Node Data", window);
    return;
    }

  /************
   * get axes *
   ************/

  combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_axes");
  row = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
  if (row == GAMGI_GTK_YES - 1) axes = TRUE;
  if (row == GAMGI_GTK_NO - 1) axes = FALSE;
  
  /********************
   * get axes_vectors *
   ********************/

  combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_axes_vectors");
  row = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
  if (row != 2) axes_vectors = row + 1;

  /*****************************************
   * get borders option_menu and menu_item *
   *****************************************/

  option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_borders");
  menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
  item_now = gtk_menu_get_active (GTK_MENU (menu));

  item = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_all");
  if (item == item_now) borders = GAMGI_PHYS_ALL;
  item = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_faces");
  if (item == item_now) borders = GAMGI_PHYS_FACES;
  item = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_edges");
  if (item == item_now) borders = GAMGI_PHYS_EDGES;
  item = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_none");
  if (item == item_now) borders = FALSE;

  /***************************************
   * get nodes option_menu and menu_item *
   ***************************************/

  option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_nodes");
  menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
  item_now = gtk_menu_get_active (GTK_MENU (menu));

  item = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_nodes_yes");
  if (item == item_now) nodes = TRUE;
  item = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_nodes_no");
  if (item == item_now) nodes = FALSE;

  /***************************************
   * get faces option_menu and menu_item *
   ***************************************/

  option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_faces");
  menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
  item_now = gtk_menu_get_active (GTK_MENU (menu));

  item = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_faces_yes");
  if (item == item_now) faces = TRUE;
  item = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "item_faces_no");
  if (item == item_now) faces = FALSE;

  /*****************************************
   * Something in the cell must be visible *
   *****************************************/

  if (borders == FALSE && faces == FALSE && nodes == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Incompatible View Data", window);
    return;
    }

  if (borders == GAMGI_PHYS_ALL && faces == TRUE)
    {
    /****************************************************************
     * inside borders and solid faces cannot be used simultaneously *
     ****************************************************************/
    
    gamgi_gtk_dialog_message_create ("Error", "Incompatible View Data", window);
    return;
    }

  if ((borders == GAMGI_PHYS_ALL || borders == GAMGI_PHYS_FACES) && 
  (type == GAMGI_PHYS_PARALLELEPIPED || type == GAMGI_PHYS_SPHERE || 
  type == GAMGI_PHYS_PROJECTION))
    {
    /*****************************************
     * inside or face borders cannot be used *
     * with parallelepiped or sphere modes   *
     *****************************************/
    
    gamgi_gtk_dialog_message_create ("Error", "Incompatible View Data", window);
    return;
    }

  if (borders == FALSE && type == GAMGI_PHYS_PROJECTION)
    {
    /**************************************************************
     * in projection mode, circumpherence borders must be visible *
     **************************************************************/

    gamgi_gtk_dialog_message_create ("Error", "Incompatible View Data", window);
    return;
    }

  if (nodes == TRUE && type == GAMGI_PHYS_PROJECTION)
    {
    /*********************************************
     * in projection mode, nodes are not visible *
     *********************************************/

    gamgi_gtk_dialog_message_create ("Error", "Incompatible View Data", window);
    return;
    }

  /*************
   * get color *
   *************/

  /*******
   * red *
   *******/
 
  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_red");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_float_scan (name, &red, 0.0, 1.0) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Color Data", window);
    return;
    }
 
  /*********
   * green *
   *********/
 
  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_green");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_float_scan (name, &green, 0.0, 1.0) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Color Data", window);
    return;
    }

  /********
   * blue *
   ********/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_blue");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE &&
  gamgi_io_token_float_scan (name, &blue, 0.0, 1.0) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Color Data", window);
    return;
    }

  /*************
   * Get scale *
   *************/

  entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_scale");
  name = gtk_entry_get_text (GTK_ENTRY (entry));
  if (gamgi_io_token_check (name) == TRUE && 
  gamgi_io_token_double_scan (name, &scale, 0.0, DBL_MAX) == FALSE)
    {
    gamgi_gtk_dialog_message_create ("Error", "Invalid Scale Data", window);
    return;
    }

  /********************************************************
   * Data is ok: save current data and update to new data *
   ********************************************************/

  /***************************************
   * Save current layer as undo buffer   *
   * layer so it can be recovered later. *
   ***************************************/

  gamgi_gtk_history_update (window->layer, window->layer->undo, GAMGI_ENGINE_UNDO);

  /***************************************
   * convert relative to absolute origin *
   ***************************************/

  button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_translation_relative");
  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) == TRUE)
    gamgi_math_vector_add (origin, origin_old, origin);

  /**************************************
   * convert relative to absolute angle *
   **************************************/

  button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_rotation_relative");
  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) == TRUE)
    gamgi_math_vector_add (euler, euler_old, euler);

  /**************
   * reset cell *
   **************/

  gamgi_math_vector_zero (zero);
  gamgi_math_position_cell_rotation_set (cell, zero);
  gamgi_math_position_cell_translation_set (cell, zero);

  free (cell->points);
  free (cell->loops);
  free (cell->lines);

  cell->points = NULL;
  cell->loops = NULL;
  cell->lines= NULL;

  cell->n_loops = 0;
  cell->n_lines = 0;
  cell->n_nodes = 0;
  cell->n_points = 0;

  /***********************
   * set cell parameters *
   ***********************/

  strcpy (cell->object.name, token);
  cell->lattice = lattice;
  cell->group = group;
  cell->a = a;
  cell->b = b;
  cell->c = c;
  cell->ab = ab;
  cell->ac = ac;
  cell->bc = bc;

  cell->type = type;
  cell->n1 = n1;
  cell->n2 = n2;
  cell->n3 = n3;
  cell->v1 = v1;
  cell->v2 = v2;
  cell->v3 = v3;
  cell->v12 = v12;
  cell->v13 = v13;
  cell->v23 = v23;

  cell->origin_vectors = origin_vectors;
  if (cell->origin_vectors == GAMGI_PHYS_CONVENTIONAL)
    gamgi_math_node_primitive (cell->lattice, 
    o1, o2, o3, o4, &cell->o1, &cell->o2, &cell->o3);
  else
    { cell->o1 = o1; cell->o2 = o2; cell->o3 = o3; }

  cell->axes = axes;
  cell->axes_vectors = axes_vectors;

  cell->borders = borders;
  cell->nodes = nodes;
  cell->faces = faces;
  cell->red = red;
  cell->green = green;
  cell->blue = blue;
  cell->object.scale = scale;

  gamgi_phys_cell_create (cell);
  gamgi_gtk_cell_align_angle (cell, euler, window);
  gamgi_gtk_cell_align_origin (cell, origin, window);
  gamgi_math_position_cell_rotation_set (cell, euler);
  gamgi_math_position_cell_translation_set (cell, origin);
  }

/**********************************************************
 * Update statubar, redraw gl_area image and reset dialog *
 **********************************************************/

gamgi_gtk_statusbar_focus_modify (window);
gtk_widget_queue_draw (window->area);
static_reset (window);
}

static void static_init (gamgi_window *window)
{
GtkWidget *dialog = window->dialog0;
GtkWidget *option_menu;
GtkWidget *combo;

/************************************
 * initialize option_menus to Local *
 ************************************/

option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_type");
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), 6);

combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_o4");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 7);

combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_origin_vectors");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 2);

combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_axes");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 2);

combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_axes_vectors");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 2);

option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_faces");
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), 2);

option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_nodes");
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), 2);

option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_borders");
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), 4);

/*************************************
 * initialize second level dialogs:  *
 * align translation, align rotation *
 *************************************/

gamgi_gtk_cell_align_start ();
}

static void static_press (gamgi_object *object, void *data)
{
gamgi_window *window = GAMGI_CAST_WINDOW data;
gamgi_cell *cell;
GtkWidget *dialog = window->dialog0;
GtkWidget *option_menu;
GtkWidget *entry;
GtkWidget *combo;
char string[2 * GAMGI_ENGINE_TOKEN];
double euler[3], origin[3];
int o1, o2, o3;
gamgi_enum o4;

cell = GAMGI_CAST_CELL object;

/***************************************************************
 * Toggles the absolute coordinates radio buttons, because     *
 * cell coordinates are absolute. This in turn triggers the    *
 * coordinate cleaning functions. Therefore static_absolute () *
 * must be called before setting the cell coordinates.         *
 ***************************************************************/

static_reset (window);
static_absolute (dialog);

/***************************
 * set Cell identification *
 ***************************/

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_cell");
sprintf (string, "%s %d", cell->object.name, cell->object.number);
gtk_entry_set_text (GTK_ENTRY (entry), string);

/****************
 * set symmetry *
 ****************/

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_a");
sprintf (string, "%.*f", gamgi->gamgi->length, cell->a);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_b");
sprintf (string, "%.*f", gamgi->gamgi->length, cell->b);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_c");
sprintf (string, "%.*f", gamgi->gamgi->length, cell->c);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_ab");
sprintf (string, "%.*f", gamgi->gamgi->angle, cell->ab);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_ac");
sprintf (string, "%.*f", gamgi->gamgi->angle, cell->ac);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_bc");
sprintf (string, "%.*f", gamgi->gamgi->angle, cell->bc);
gtk_entry_set_text (GTK_ENTRY (entry), string);

gamgi_gtk_cell_symmetry_press (cell, window);

/******************************************
 * set Type: Type, Cells, Lengths, Angles *
 ******************************************/

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_n1");
sprintf (string, "%d", cell->n1);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_n2");
sprintf (string, "%d", cell->n2);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_n3");
sprintf (string, "%d", cell->n3);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v1");
sprintf (string, "%.*f", gamgi->gamgi->length, cell->v1);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v2");
sprintf (string, "%.*f", gamgi->gamgi->length, cell->v2);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v3");
sprintf (string, "%.*f", gamgi->gamgi->length, cell->v3);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v12");
sprintf (string, "%.*f", gamgi->gamgi->angle, cell->v12);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v13");
sprintf (string, "%.*f", gamgi->gamgi->angle, cell->v13);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_v23");
sprintf (string, "%.*f", gamgi->gamgi->angle, cell->v23);
gtk_entry_set_text (GTK_ENTRY (entry), string);

option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_type");
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), cell->type - 1);

static_type (NULL, window);

/*************************
 * set Position: Lengths *
 *************************/

gamgi_math_position_cell_translation_get (cell, origin);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_x");
if (GTK_WIDGET_SENSITIVE (entry) == TRUE)
  {
  sprintf (string, "%.*f", gamgi->gamgi->length, origin[0]);
  gtk_entry_set_text (GTK_ENTRY (entry), string);
  }

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_y");
if (GTK_WIDGET_SENSITIVE (entry) == TRUE)
  {
  sprintf (string, "%.*f", gamgi->gamgi->length, origin[1]);
  gtk_entry_set_text (GTK_ENTRY (entry), string);
  }

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_z");
if (GTK_WIDGET_SENSITIVE (entry) == TRUE)
  {
  sprintf (string, "%.*f", gamgi->gamgi->length, origin[2]);
  gtk_entry_set_text (GTK_ENTRY (entry), string);
  }

/************************
 * set Rotation: Angles *
 ************************/

gamgi_math_position_cell_rotation_get (cell, euler);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_e1");
if (GTK_WIDGET_SENSITIVE (entry) == TRUE)
  {
  sprintf (string, "%.*f", gamgi->gamgi->angle, euler[0]);
  gtk_entry_set_text (GTK_ENTRY (entry), string);
  }

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_e2");
if (GTK_WIDGET_SENSITIVE (entry) == TRUE)
  {
  sprintf (string, "%.*f", gamgi->gamgi->angle, euler[1]);
  gtk_entry_set_text (GTK_ENTRY (entry), string);
  }

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_e3");
if (GTK_WIDGET_SENSITIVE (entry) == TRUE)
  {
  sprintf (string, "%.*f", gamgi->gamgi->angle, euler[2]);
  gtk_entry_set_text (GTK_ENTRY (entry), string);
  }

/***************************************************************
 * set Origin: o1,o2,o3,o4, origin_vectors, axes, axes_vectors *
 ***************************************************************/

if (cell->origin_vectors == GAMGI_PHYS_CONVENTIONAL)
  gamgi_math_node_conventional (cell->lattice, 
  cell->o1, cell->o2, cell->o3, &o1, &o2, &o3, &o4);
else
  { o1 = cell->o1; o2 = cell->o2; o3 = cell->o3; o4 = FALSE; }

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_o1");
sprintf (string, "%d", o1);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_o2");
sprintf (string, "%d", o2);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_o3");
sprintf (string, "%d", o3);
gtk_entry_set_text (GTK_ENTRY (entry), string);

combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_o4");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), o4);

combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_origin_vectors");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), cell->origin_vectors - 1);

combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_axes");
if (cell->axes == TRUE)
  gtk_combo_box_set_active (GTK_COMBO_BOX (combo), GAMGI_GTK_YES - 1);
if (cell->axes == FALSE)
  gtk_combo_box_set_active (GTK_COMBO_BOX (combo), GAMGI_GTK_NO - 1);

combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_axes_vectors");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), cell->axes_vectors - 1);

/*****************************************************************
 * set View: Faces, Borders, Nodes, Color, Scale (by this order) *
 *****************************************************************/

option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_faces");
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), cell->faces);

option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_borders");
if (cell->borders == FALSE) gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), 3);
else gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), cell->borders - 1);

option_menu = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "menu_nodes");
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), cell->nodes);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_red");
sprintf (string, "%.*f", GAMGI_MATH_DECIMAL_COLOR, cell->red);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_green");
sprintf (string, "%.*f", GAMGI_MATH_DECIMAL_COLOR, cell->green);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_blue");
sprintf (string, "%.*f", GAMGI_MATH_DECIMAL_COLOR, cell->blue);
gtk_entry_set_text (GTK_ENTRY (entry), string);

entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_scale");
sprintf (string, "%.*f", GAMGI_MATH_DECIMAL_SCALE, cell->object.scale);
gtk_entry_set_text (GTK_ENTRY (entry), string);

static_faces (NULL, window);
}

/*************** external function *************
 *                                             *
 *          GAMGI_GTK_CELL_MODIFY_PRESS        *
 *                                             *
 *                                             *
 ***********************************************/

void gamgi_gtk_cell_modify_press (gamgi_window *window_mouse,
int x, int y, gamgi_window *window_dialog)
{
GtkWidget *dialog = window_dialog->dialog0;
GtkWidget *button;

/******************************
 * local mouse selection only *
 ******************************/

if (window_dialog != window_mouse) return;

button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_translation");
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) == TRUE)
  { gamgi_gtk_cell_align_press (window_dialog, x, y); return; }

button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_rotation");
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) == TRUE)
  { gamgi_gtk_cell_align_press (window_dialog, x, y); return; }

button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_global");
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) == TRUE) return;

gamgi_mesa_select_object (window_mouse, x, y, 
GAMGI_ENGINE_CELL, FALSE, static_press);
}

/*************** external function ******************
 *                                                  *
 *              GAMGI_GTK_CELL_MODIFY               *
 *                                                  *
 *  Creates the dialog window used to create cells. *
 *                                                  *
 ****************************************************/

void gamgi_gtk_cell_modify (GtkWidget *widget, void *data)
{
gamgi_window *window = GAMGI_CAST_WINDOW data;
GtkWidget *dialog;
GtkWidget *notebook;
GtkWidget *button;
GtkWidget *label;
GtkWidget *entry;
GtkWidget *frame;
GtkWidget *table;
GtkWidget *hbox_center, *hbox_left, *hbox_left_left;
GtkWidget *vbox_dialog, *vbox_page, *vbox_frame, *vbox_top, *vbox_top_top;
GtkWidget *option_menu, *menu, *item;
GtkWidget *combo;
GtkListStore *store;
GtkCellRenderer *renderer;
GtkTreeIter iter;
gamgi_bool *sensitive;

/******************
 * dialog level 0 *
 ******************/

dialog = gamgi_gtk_dialog_task0_create ("Cell Modify", window);
window->action = GAMGI_GTK_CELL_MODIFY;
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);

/********************
 * global container *
 ********************/

vbox_dialog = gtk_vbox_new (FALSE, 5);
gtk_container_add (GTK_CONTAINER (dialog), vbox_dialog);
gtk_widget_show (vbox_dialog);

/****************
 * Cell objects *
 ****************/

hbox_center = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox_dialog), hbox_center, FALSE, FALSE, 0);
gtk_widget_show (hbox_center);

hbox_left = gtk_hbox_new (FALSE, 10);
gtk_box_pack_start (GTK_BOX (hbox_center), hbox_left, FALSE, FALSE, 0);
gtk_widget_show (hbox_left);

/*********
 * Local *
 *********/

hbox_left_left = gtk_hbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (hbox_left), hbox_left_left, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (dialog), "hbox_cell", hbox_left_left);
gtk_widget_show (hbox_left_left);

label = gtk_label_new ("Cell");
gtk_box_pack_start (GTK_BOX (hbox_left_left), label, FALSE, FALSE, 0);
gtk_widget_show (label);

entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (hbox_left_left), entry, FALSE, FALSE, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_20);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_20);
g_object_set_data (G_OBJECT (dialog), "entry_cell", entry);
gtk_widget_show (entry);

/**********
 * Global *
 **********/

button = gtk_toggle_button_new_with_label ("Global");
gtk_box_pack_start (GTK_BOX (hbox_left), button, FALSE, FALSE, 0);
g_signal_connect (GTK_OBJECT (button), "toggled",
G_CALLBACK (static_global), window);
g_object_set_data (G_OBJECT (dialog), "button_global", button);
gtk_widget_show (button);

/************
 * notebook *
 ************/

notebook = gtk_notebook_new ();
gtk_box_pack_start (GTK_BOX (vbox_dialog), notebook, FALSE, FALSE, 0);
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
g_signal_connect (GTK_OBJECT (notebook), "switch_page",
G_CALLBACK (static_switch), window);
g_object_set_data (G_OBJECT (dialog), "notebook", notebook);
gtk_widget_show (notebook);

/*****************
 * Symmetry page *
 *****************/

vbox_page = gtk_vbox_new (FALSE, 5);
label = gtk_label_new ("Symmetry");
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox_page, label);
gtk_container_set_border_width (GTK_CONTAINER (vbox_page), 5);
gtk_widget_show (vbox_page);

/************************************************
 * symmetry section (including level 2 dialogs) *
 ************************************************/

gamgi_gtk_cell_symmetry (vbox_page, window);

/**********************************
 * Type page: Type, Length, Angle *
 **********************************/

vbox_page = gtk_vbox_new (FALSE, 5);
label = gtk_label_new (" Type ");
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox_page, label);
gtk_container_set_border_width (GTK_CONTAINER (vbox_page), 5);
gtk_widget_show (vbox_page);

/****************
 * Type section *
 ****************/

frame = gtk_frame_new (NULL);
gtk_box_pack_start (GTK_BOX (vbox_page), frame, TRUE, TRUE, 0);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_widget_show (frame);

vbox_frame = gtk_vbox_new (TRUE, 0);
gtk_container_add (GTK_CONTAINER (frame), vbox_frame);
gtk_container_set_border_width (GTK_CONTAINER (vbox_frame), 5);
gtk_widget_show (vbox_frame);

vbox_top = gtk_vbox_new (FALSE, 10);
gtk_box_pack_start (GTK_BOX (vbox_frame), vbox_top, FALSE, FALSE, 0);
gtk_widget_show (vbox_top);

/********************
 * Type option menu *
 ********************/

hbox_center = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox_top), hbox_center, FALSE, FALSE, 0);
gtk_widget_show (hbox_center);

option_menu = gtk_option_menu_new ();
gtk_box_pack_start (GTK_BOX (hbox_center), option_menu, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (dialog), "menu_type", option_menu);
menu = gtk_menu_new ();

item = gtk_radio_menu_item_new_with_label (NULL, "Conventional");
gtk_menu_append (GTK_MENU (menu), item);
g_signal_connect (GTK_OBJECT (item), "activate",
G_CALLBACK (static_type), window);
g_object_set_data (G_OBJECT (dialog), "item_conventional", item);
gtk_widget_show (item);

item = gtk_radio_menu_item_new_with_label (
gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)), "Primitive");
gtk_menu_append (GTK_MENU (menu), item);
g_signal_connect (GTK_OBJECT (item), "activate",
G_CALLBACK (static_type), window);
g_object_set_data (G_OBJECT (dialog), "item_primitive", item);
gtk_widget_show (item);

item = gtk_radio_menu_item_new_with_label (
gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)), "Wigner-Seitz");
gtk_menu_append (GTK_MENU (menu), item);
g_signal_connect (GTK_OBJECT (item), "activate",
G_CALLBACK (static_type), window);
g_object_set_data (G_OBJECT (dialog), "item_wigner", item);
gtk_widget_show (item);

item = gtk_radio_menu_item_new_with_label (
gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)), "Parallelepiped");
gtk_menu_append (GTK_MENU (menu), item);
g_signal_connect (GTK_OBJECT (item), "activate",
G_CALLBACK (static_type), window);
g_object_set_data (G_OBJECT (dialog), "item_parallelepiped", item);
gtk_widget_show (item);

item = gtk_radio_menu_item_new_with_label (
gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)), "Sphere");
gtk_menu_append (GTK_MENU (menu), item);
g_signal_connect (GTK_OBJECT (item), "activate",
G_CALLBACK (static_type), window);
g_object_set_data (G_OBJECT (dialog), "item_sphere", item);
gtk_widget_show (item);

item = gtk_radio_menu_item_new_with_label (
gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)), "Projection");
gtk_menu_append (GTK_MENU (menu), item);
g_signal_connect (GTK_OBJECT (item), "activate",
G_CALLBACK (static_type), window);
g_object_set_data (G_OBJECT (dialog), "item_projection", item);
gtk_widget_show (item);

item = gtk_radio_menu_item_new_with_label (
gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)), "Local");
gtk_menu_append (GTK_MENU (menu), item);
g_signal_connect (GTK_OBJECT (item), "activate",
G_CALLBACK (static_type), window);
g_object_set_data (G_OBJECT (dialog), "item_item_local", item);
gtk_widget_show (item);

gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
gtk_widget_show (option_menu);

/*******************************
 * Cell, Length, Angle entries * 
 *******************************/

hbox_center = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox_top), hbox_center, FALSE, FALSE, 0);
gtk_widget_show (hbox_center);

table = gtk_table_new (7, 3, FALSE);
gtk_box_pack_start (GTK_BOX (hbox_center), table, FALSE, FALSE, 5);
gtk_widget_show (table);

/*********
 * Cells *
 *********/

label = gtk_label_new ("Cells");
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_widget_show (label);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
g_object_set_data (G_OBJECT (dialog), "entry_n1", entry);
gtk_widget_show (entry);

label = gtk_label_new ("n1");
gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
g_object_set_data (G_OBJECT (dialog), "label_n1", label);
gtk_widget_show (label);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
g_object_set_data (G_OBJECT (dialog), "entry_n2", entry);
gtk_widget_show (entry);

label = gtk_label_new ("n2");
gtk_table_attach (GTK_TABLE (table), label, 4, 5, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
g_object_set_data (G_OBJECT (dialog), "label_n2", label);
gtk_widget_show (label);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 5, 6, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
g_object_set_data (G_OBJECT (dialog), "entry_n3", entry);
gtk_widget_show (entry);

label = gtk_label_new ("n3");
gtk_table_attach (GTK_TABLE (table), label, 6, 7, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
g_object_set_data (G_OBJECT (dialog), "label_n3", label);
gtk_widget_show (label);

/**********
 * Length *
 **********/

label = gtk_label_new ("Length");
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 5, 0);
gtk_widget_show (label);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
g_object_set_data (G_OBJECT (dialog), "entry_v1", entry);
gtk_widget_show (entry);

label = gtk_label_new ("a");
gtk_table_attach (GTK_TABLE (table), label, 2, 3, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
g_object_set_data (G_OBJECT (dialog), "label_v1", label);
gtk_widget_show (label);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 3, 4, 1, 2, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
g_object_set_data (G_OBJECT (dialog), "entry_v2", entry);
gtk_widget_show (entry);

label = gtk_label_new ("b");
gtk_table_attach (GTK_TABLE (table), label, 4, 5, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
g_object_set_data (G_OBJECT (dialog), "label_v2", label);
gtk_widget_show (label);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 5, 6, 1, 2, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
g_object_set_data (G_OBJECT (dialog), "entry_v3", entry);
gtk_widget_show (entry);

label = gtk_label_new ("c");
gtk_table_attach (GTK_TABLE (table), label, 6, 7, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
g_object_set_data (G_OBJECT (dialog), "label_v3", label);
gtk_widget_show (label);

/*********
 * Angle *
 *********/

label = gtk_label_new ("Angle");
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 5, 0);
gtk_widget_show (label);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 2, 3, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
g_object_set_data (G_OBJECT (dialog), "entry_v23", entry);
gtk_widget_show (entry);

label = gtk_label_new ("bc");
gtk_table_attach (GTK_TABLE (table), label, 2, 3, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
g_object_set_data (G_OBJECT (dialog), "label_v23", label);
gtk_widget_show (label);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 3, 4, 2, 3, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
g_object_set_data (G_OBJECT (dialog), "entry_v13", entry);
gtk_widget_show (entry);

label = gtk_label_new ("ac");
gtk_table_attach (GTK_TABLE (table), label, 4, 5, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
g_object_set_data (G_OBJECT (dialog), "label_v13", label);
gtk_widget_show (label);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 5, 6, 2, 3, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
g_object_set_data (G_OBJECT (dialog), "entry_v12", entry);
gtk_widget_show (entry);

label = gtk_label_new ("ab");
gtk_table_attach (GTK_TABLE (table), label, 6, 7, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
g_object_set_data (G_OBJECT (dialog), "label_v12", label);
gtk_widget_show (label);

/*****************
 * Position page *
 *****************/

vbox_page = gtk_vbox_new (FALSE, 5);
label = gtk_label_new ("Position");
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox_page, label);
gtk_container_set_border_width (GTK_CONTAINER (vbox_page), 5);
gtk_widget_show (vbox_page);

frame = gtk_frame_new (NULL);
gtk_box_pack_start (GTK_BOX (vbox_page), frame, TRUE, TRUE, 0);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_widget_show (frame);

vbox_frame = gtk_vbox_new (TRUE, 10);
gtk_container_add (GTK_CONTAINER (frame), vbox_frame);
gtk_container_set_border_width (GTK_CONTAINER (vbox_frame), 5);
gtk_widget_show (vbox_frame);

/***************
 * Translation *
 ***************/

vbox_top = gtk_vbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (vbox_frame), vbox_top, FALSE, FALSE, 0);
gtk_widget_show (vbox_top);

hbox_center = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox_top), hbox_center, FALSE, FALSE, 0);
gtk_widget_show (hbox_center);

hbox_left = gtk_hbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (hbox_center), hbox_left, FALSE, FALSE, 0);
gtk_widget_show (hbox_left);

label = gtk_label_new ("Translation");
gtk_box_pack_start (GTK_BOX (hbox_left), label, FALSE, FALSE, 5);
gtk_widget_show (label);

button = gtk_radio_button_new_with_label (NULL, "Absolute");
gtk_box_pack_start (GTK_BOX (hbox_left), button, FALSE, FALSE, 0);
g_signal_connect (GTK_OBJECT (button), "toggled",
G_CALLBACK (static_translation_clean), window);
g_object_set_data (G_OBJECT (dialog), "button_translation_absolute", button);
gtk_widget_show (button);

button = gtk_radio_button_new_with_label (
gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "Relative");
gtk_box_pack_start (GTK_BOX (hbox_left), button, FALSE, FALSE, 0);
g_signal_connect (GTK_OBJECT (button), "toggled",
G_CALLBACK (static_translation_clean), window);
g_object_set_data (G_OBJECT (dialog), "button_translation_relative", button);
gtk_widget_show (button);

button = gtk_toggle_button_new_with_label ("Align");
gtk_box_pack_start (GTK_BOX (hbox_left), button, FALSE, FALSE, 0);
g_signal_connect (GTK_OBJECT (button), "clicked",
G_CALLBACK (gamgi_gtk_cell_align_translation), window);
g_object_set_data (G_OBJECT (dialog), "button_translation", button);
gtk_widget_show (button);

/***********
 * new row *
 ***********/

hbox_center = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox_top), hbox_center, FALSE, FALSE, 0);
gtk_widget_show (hbox_center);

table = gtk_table_new (1, 6, FALSE);
gtk_box_pack_start (GTK_BOX (hbox_center), table, FALSE, FALSE, 5);
gtk_widget_show (table);

label = gtk_label_new ("X");
gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
g_object_set_data (G_OBJECT (dialog), "label_x", label);
gtk_widget_show (label);

label = gtk_label_new ("Y");
gtk_table_attach (GTK_TABLE (table), label, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
g_object_set_data (G_OBJECT (dialog), "label_y", label);
gtk_widget_show (label);

label = gtk_label_new ("Z");
gtk_table_attach (GTK_TABLE (table), label, 5, 6, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
g_object_set_data (G_OBJECT (dialog), "label_z", label);
gtk_widget_show (label);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
g_object_set_data (G_OBJECT (dialog), "entry_x", entry);
gtk_widget_show (entry);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
g_object_set_data (G_OBJECT (dialog), "entry_y", entry);
gtk_widget_show (entry);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 4, 5, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
g_object_set_data (G_OBJECT (dialog), "entry_z", entry);
gtk_widget_show (entry);

/************
 * Rotation *
 ************/

vbox_top = gtk_vbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (vbox_frame), vbox_top, FALSE, FALSE, 0);
gtk_widget_show (vbox_top);

hbox_center = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox_top), hbox_center, FALSE, FALSE, 0);
gtk_widget_show (hbox_center);

hbox_left = gtk_hbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (hbox_center), hbox_left, FALSE, FALSE, 0);
gtk_widget_show (hbox_left);

label = gtk_label_new ("Rotation");
gtk_box_pack_start (GTK_BOX (hbox_left), label, FALSE, FALSE, 5);
gtk_widget_show (label);

button = gtk_radio_button_new_with_label (NULL, "Absolute");
gtk_box_pack_start (GTK_BOX (hbox_left), button, FALSE, FALSE, 0);
g_signal_connect (GTK_OBJECT (button), "toggled",
G_CALLBACK (static_rotation_clean), window);
g_object_set_data (G_OBJECT (dialog), "button_rotation_absolute", button);
gtk_widget_show (button);

button = gtk_radio_button_new_with_label (
gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "Relative");
gtk_box_pack_start (GTK_BOX (hbox_left), button, FALSE, FALSE, 0);
g_signal_connect (GTK_OBJECT (button), "toggled",
G_CALLBACK (static_rotation_clean), window);
g_object_set_data (G_OBJECT (dialog), "button_rotation_relative", button);
gtk_widget_show (button);

button = gtk_toggle_button_new_with_label ("Align");
gtk_box_pack_start (GTK_BOX (hbox_left), button, FALSE, FALSE, 0);
g_signal_connect (GTK_OBJECT (button), "clicked",
G_CALLBACK (gamgi_gtk_cell_align_rotation), window);
g_object_set_data (G_OBJECT (dialog), "button_rotation", button);
gtk_widget_show (button);

/***********
 * new row *
 ***********/

hbox_center = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox_top), hbox_center, FALSE, FALSE, 0);
gtk_widget_show (hbox_center);

table = gtk_table_new (1, 6, FALSE);
gtk_box_pack_start (GTK_BOX (hbox_center), table, FALSE, FALSE, 5);
gtk_widget_show (table);

label = gtk_label_new ("E1");
gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
g_object_set_data (G_OBJECT (dialog), "label_e1", label);
gtk_widget_show (label);

label = gtk_label_new ("E2");
gtk_table_attach (GTK_TABLE (table), label, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
g_object_set_data (G_OBJECT (dialog), "label_e2", label);
gtk_widget_show (label);

label = gtk_label_new ("E3");
gtk_table_attach (GTK_TABLE (table), label, 5, 6, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
g_object_set_data (G_OBJECT (dialog), "label_e3", label);
gtk_widget_show (label);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
g_object_set_data (G_OBJECT (dialog), "entry_e1", entry);
gtk_widget_show (entry);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
g_object_set_data (G_OBJECT (dialog), "entry_e2", entry);
gtk_widget_show (entry);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 4, 5, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
g_object_set_data (G_OBJECT (dialog), "entry_e3", entry);
gtk_widget_show (entry);

/***************
 * Origin page *
 ***************/

vbox_page = gtk_vbox_new (FALSE, 5);
label = gtk_label_new ("Origin");
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox_page, label);
gtk_container_set_border_width (GTK_CONTAINER (vbox_page), 5);
gtk_widget_show (vbox_page);

frame = gtk_frame_new (NULL);
gtk_box_pack_start (GTK_BOX (vbox_page), frame, TRUE, TRUE, 0);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_widget_show (frame);

vbox_frame = gtk_vbox_new (TRUE, 5);
gtk_container_add (GTK_CONTAINER (frame), vbox_frame);
gtk_container_set_border_width (GTK_CONTAINER (vbox_frame), 5);
gtk_widget_show (vbox_frame);

hbox_center = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox_frame), hbox_center, FALSE, FALSE, 0);
gtk_widget_show (hbox_center);

vbox_top = gtk_vbox_new (FALSE, 10);
gtk_box_pack_start (GTK_BOX (hbox_center), vbox_top, FALSE, FALSE, 0);
gtk_widget_show (vbox_top);

/*****************
 * 1st row: Node *
 *****************/

vbox_top_top = gtk_vbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (vbox_top), vbox_top_top, FALSE, FALSE, 0);
gtk_widget_show (vbox_top_top);

table = gtk_table_new (1, 7, FALSE);
gtk_box_pack_start (GTK_BOX (vbox_top_top), table, FALSE, FALSE, 0);
gtk_widget_show (table);

label = gtk_label_new ("Node");
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_widget_show (label);

label = gtk_label_new ("O1");
gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);

label = gtk_label_new ("O2");
gtk_table_attach (GTK_TABLE (table), label, 4, 5, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);

label = gtk_label_new ("O3");
gtk_table_attach (GTK_TABLE (table), label, 6, 7, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
g_object_set_data (G_OBJECT (dialog), "entry_o1", entry);
gtk_widget_show (entry);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
g_object_set_data (G_OBJECT (dialog), "entry_o2", entry);
gtk_widget_show (entry);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 5, 6, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
g_object_set_data (G_OBJECT (dialog), "entry_o3", entry);
gtk_widget_show (entry);

/************************
 * 2nd row: o4, Vectors *
 ************************/

hbox_left = gtk_hbox_new (FALSE, 25);
gtk_box_pack_start (GTK_BOX (vbox_top_top), hbox_left, FALSE, FALSE, 0);
gtk_widget_show (hbox_left);

hbox_left_left = gtk_hbox_new (FALSE, 5);
gtk_box_pack_end (GTK_BOX (hbox_left), hbox_left_left, FALSE, FALSE, 0);
gtk_widget_show (hbox_left_left);

combo = gtk_combo_box_new ();
gtk_box_pack_end (GTK_BOX (hbox_left_left), combo, FALSE, FALSE, 0);
g_signal_connect (GTK_OBJECT (combo), "changed",
G_CALLBACK (static_vectors), window);
g_object_set_data (G_OBJECT (dialog), "combo_origin_vectors", combo);
gtk_widget_show (combo);

store = gtk_list_store_new (1, G_TYPE_STRING);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "Conventional", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "Primitive", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "Local", -1);
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
g_object_unref (store);

renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, "text", 0, NULL);

label = gtk_label_new ("Vectors");
gtk_box_pack_end (GTK_BOX (hbox_left_left), label, FALSE, FALSE, 0);
gtk_widget_show (label);

hbox_left_left = gtk_hbox_new (FALSE, 5);
gtk_box_pack_end (GTK_BOX (hbox_left), hbox_left_left, FALSE, FALSE, 0);
gtk_widget_show (hbox_left_left);

combo = gtk_combo_box_new ();
gtk_box_pack_end (GTK_BOX (hbox_left_left), combo, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (dialog), "combo_o4", combo);
gtk_widget_show (combo);

store = gtk_list_store_new (1, G_TYPE_STRING);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "000", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "011", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "101", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "110", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "111", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "122", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "211", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "Local", -1);
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
g_object_unref (store);

renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, "text", 0, NULL);

sensitive = gamgi_gtk_dialog_sensitive_create (8);
g_object_set_data (G_OBJECT (dialog), "sensitive_o4", sensitive);
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo),
renderer, gamgi_gtk_dialog_sensitive_scan, sensitive, free);

label = gtk_label_new ("O4");
gtk_box_pack_end (GTK_BOX (hbox_left_left), label, FALSE, FALSE, 0);
gtk_widget_show (label);

/**************************
 * 3rd row: Axes, Vectors *
 **************************/

hbox_left = gtk_hbox_new (FALSE, 25);
gtk_box_pack_start (GTK_BOX (vbox_top), hbox_left, FALSE, FALSE, 0);
gtk_widget_show (hbox_left);

hbox_left_left = gtk_hbox_new (FALSE, 5);
gtk_box_pack_end (GTK_BOX (hbox_left), hbox_left_left, FALSE, FALSE, 0);
gtk_widget_show (hbox_left_left);

combo = gtk_combo_box_new ();
gtk_box_pack_end (GTK_BOX (hbox_left_left), combo, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (dialog), "combo_axes_vectors", combo);
gtk_widget_show (combo);

store = gtk_list_store_new (1, G_TYPE_STRING);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "Conventional", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "Primitive", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "Local", -1);
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
g_object_unref (store);

renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, "text", 0, NULL);

label = gtk_label_new ("Vectors");
gtk_box_pack_end (GTK_BOX (hbox_left_left), label, FALSE, FALSE, 0);
gtk_widget_show (label);

hbox_left_left = gtk_hbox_new (FALSE, 5);
gtk_box_pack_end (GTK_BOX (hbox_left), hbox_left_left, FALSE, FALSE, 0);
gtk_widget_show (hbox_left_left);

combo = gtk_combo_box_new ();
gtk_box_pack_end (GTK_BOX (hbox_left_left), combo, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (dialog), "combo_axes", combo);
gtk_widget_show (combo);

store = gtk_list_store_new (1, G_TYPE_STRING);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "Yes", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "No", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "Local", -1);
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
g_object_unref (store);

renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, "text", 0, NULL);

label = gtk_label_new ("Axes");
gtk_box_pack_end (GTK_BOX (hbox_left_left), label, FALSE, FALSE, 0);
gtk_widget_show (label);

/**************
 * View page: *
 **************/

vbox_page = gtk_vbox_new (FALSE, 5);
label = gtk_label_new (" View ");
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox_page, label);
gtk_container_set_border_width (GTK_CONTAINER (vbox_page), 5);
gtk_widget_show (vbox_page);

frame = gtk_frame_new (NULL);
gtk_box_pack_start (GTK_BOX (vbox_page), frame, TRUE, TRUE, 0);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_widget_show (frame);

vbox_frame = gtk_vbox_new (TRUE, 0);
gtk_container_add (GTK_CONTAINER (frame), vbox_frame);
gtk_container_set_border_width (GTK_CONTAINER (vbox_frame), 5);
gtk_widget_show (vbox_frame);

vbox_top = gtk_vbox_new (FALSE, 10);
gtk_box_pack_start (GTK_BOX (vbox_frame), vbox_top, FALSE, FALSE, 0);
gtk_widget_show (vbox_top);

/**********************************
 * 1st row: Borders, Faces, Nodes *
 **********************************/

hbox_center = gtk_hbox_new (TRUE, 5);
gtk_box_pack_start (GTK_BOX (vbox_top), hbox_center, FALSE, FALSE, 0);
gtk_widget_show (hbox_center);

table = gtk_table_new (1, 3, FALSE);
gtk_box_pack_start (GTK_BOX (hbox_center), table, FALSE, FALSE, 0);
gtk_widget_show (table);

/***********
 * Borders *
 ***********/

vbox_top_top = gtk_vbox_new (FALSE, 0);
gtk_table_attach (GTK_TABLE (table), vbox_top_top, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 10, 0);
gtk_widget_show (vbox_top_top);

label = gtk_label_new ("Borders");
gtk_box_pack_start (GTK_BOX (vbox_top_top), label, FALSE, FALSE, 0);
gtk_widget_show (label);

option_menu = gtk_option_menu_new ();
gtk_box_pack_start (GTK_BOX (vbox_top_top), option_menu, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (dialog), "menu_borders", option_menu);
menu = gtk_menu_new ();

item = gtk_radio_menu_item_new_with_label (NULL, "All");
gtk_menu_append (GTK_MENU (menu), item);
g_object_set_data (G_OBJECT (dialog), "item_all", item);
gtk_widget_show (item);

item = gtk_radio_menu_item_new_with_label (
gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)), "Faces");
gtk_menu_append (GTK_MENU (menu), item);
g_object_set_data (G_OBJECT (dialog), "item_faces", item);
gtk_widget_show (item);

item = gtk_radio_menu_item_new_with_label (
gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)), "Edges");
gtk_menu_append (GTK_MENU (menu), item);
g_object_set_data (G_OBJECT (dialog), "item_edges", item);
gtk_widget_show (item);

item = gtk_radio_menu_item_new_with_label (
gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)), "None");
gtk_menu_append (GTK_MENU (menu), item);
g_object_set_data (G_OBJECT (dialog), "item_none", item);
gtk_widget_show (item);

item = gtk_radio_menu_item_new_with_label (
gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)), "Local");
gtk_menu_append (GTK_MENU (menu), item);
gtk_widget_show (item);

gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
gtk_widget_show (option_menu);

/*********
 * Faces *
 *********/

vbox_top_top = gtk_vbox_new (FALSE, 0);
gtk_table_attach (GTK_TABLE (table), vbox_top_top, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 10, 0);
g_object_set_data (G_OBJECT (dialog), "vbox_faces", vbox_top_top);
gtk_widget_show (vbox_top_top);

label = gtk_label_new ("Faces");
gtk_box_pack_start (GTK_BOX (vbox_top_top), label, FALSE, FALSE, 0);
gtk_widget_show (label);

option_menu = gtk_option_menu_new ();
gtk_box_pack_start (GTK_BOX (vbox_top_top), option_menu, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (dialog), "menu_faces", option_menu);
menu = gtk_menu_new ();

item = gtk_radio_menu_item_new_with_label (NULL, "No");
gtk_menu_append (GTK_MENU (menu), item);
g_signal_connect (GTK_OBJECT (item), "activate",
G_CALLBACK (static_faces), window);
g_object_set_data (G_OBJECT (dialog), "item_faces_no", item);
gtk_widget_show (item);

item = gtk_radio_menu_item_new_with_label (
gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)), "Yes");
gtk_menu_append (GTK_MENU (menu), item);
g_signal_connect (GTK_OBJECT (item), "activate",
G_CALLBACK (static_faces), window);
g_object_set_data (G_OBJECT (dialog), "item_faces_yes", item);
gtk_widget_show (item);

item = gtk_radio_menu_item_new_with_label (
gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)), "Local");
gtk_menu_append (GTK_MENU (menu), item);
g_signal_connect (GTK_OBJECT (item), "activate",
G_CALLBACK (static_faces), window);
gtk_widget_show (item);

gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
gtk_widget_show (option_menu);

/*********
 * Nodes *
 *********/

vbox_top_top = gtk_vbox_new (FALSE, 0);
gtk_table_attach (GTK_TABLE (table), vbox_top_top, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 10, 0);
g_object_set_data (G_OBJECT (dialog), "vbox_nodes", vbox_top_top);
gtk_widget_show (vbox_top_top);

label = gtk_label_new ("Nodes");
gtk_box_pack_start (GTK_BOX (vbox_top_top), label, FALSE, FALSE, 0);
gtk_widget_show (label);

option_menu = gtk_option_menu_new ();
gtk_box_pack_start (GTK_BOX (vbox_top_top), option_menu, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (dialog), "menu_nodes", option_menu);
menu = gtk_menu_new ();

item = gtk_radio_menu_item_new_with_label (NULL, "No");
gtk_menu_append (GTK_MENU (menu), item);
g_object_set_data (G_OBJECT (dialog), "item_nodes_no", item);
gtk_widget_show (item);

item = gtk_radio_menu_item_new_with_label (
gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)), "Yes");
gtk_menu_append (GTK_MENU (menu), item);
g_object_set_data (G_OBJECT (dialog), "item_nodes_yes", item);
gtk_widget_show (item);

item = gtk_radio_menu_item_new_with_label (
gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)), "Local");
gtk_menu_append (GTK_MENU (menu), item);
gtk_widget_show (item);

gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
gtk_widget_show (option_menu);

/******************
 * 2nd row: Color *
 ******************/

hbox_center = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox_top), hbox_center, FALSE, FALSE, 0);
gtk_widget_show (hbox_center);

table = gtk_table_new (1, 7, FALSE);
gtk_box_pack_start (GTK_BOX (hbox_center), table, FALSE, FALSE, 0);
gtk_widget_show (table);

label = gtk_label_new ("Color");
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_widget_show (label);

label = gtk_label_new ("R");
gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_widget_show (label);

label = gtk_label_new ("G");
gtk_table_attach (GTK_TABLE (table), label, 4, 5, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_widget_show (label);

label = gtk_label_new ("B");
gtk_table_attach (GTK_TABLE (table), label, 6, 7, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_widget_show (label);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
g_object_set_data (G_OBJECT (dialog), "entry_red", entry);
gtk_widget_show (entry);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
g_object_set_data (G_OBJECT (dialog), "entry_green", entry);
gtk_widget_show (entry);

entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), entry, 5, 6, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
g_object_set_data (G_OBJECT (dialog), "entry_blue", entry);
gtk_widget_show (entry);

/******************
 * 3rd row: Scale *
 ******************/

hbox_center = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox_top), hbox_center, FALSE, FALSE, 0);
gtk_widget_show (hbox_center);

hbox_left = gtk_hbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (hbox_center), hbox_left, FALSE, FALSE, 0);
gtk_widget_show (hbox_left);

label = gtk_label_new ("Scale");
gtk_box_pack_start (GTK_BOX (hbox_left), label, FALSE, FALSE, 0);
gtk_widget_show (label);

entry = gtk_entry_new ();
gtk_box_pack_end (GTK_BOX (hbox_left), entry, FALSE, FALSE, 0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
g_object_set_data (G_OBJECT (dialog), "entry_scale", entry);
gtk_widget_show (entry);

/*********************
 * Ok/Cancel buttons *
 *********************/

hbox_center = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox_dialog), hbox_center, FALSE, FALSE, 0);
gtk_widget_show (hbox_center);

button = gamgi_gtk_dialog_button_create ("Ok", NULL);
gtk_box_pack_start (GTK_BOX (hbox_center), button, FALSE, FALSE, 0);
gtk_widget_set_size_request (button, GAMGI_GTK_BUTTON_WIDTH, -1);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
g_signal_connect (GTK_OBJECT (button), "clicked",
G_CALLBACK (static_ok), window);
gtk_widget_show (button);

button = gamgi_gtk_dialog_button_create ("Cancel", "red");
gtk_box_pack_start (GTK_BOX (hbox_center), button, FALSE, FALSE, 0);
gtk_widget_set_size_request (button, GAMGI_GTK_BUTTON_WIDTH, -1);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_focus (button);
g_signal_connect (GTK_OBJECT (button), "clicked",
G_CALLBACK (gamgi_gtk_dialog_task0_remove), window);
gtk_widget_show (button);

static_init (window);
gtk_widget_show (dialog);
}

Generated by  Doxygen 1.6.0   Back to index