"Fossies" - the Fresh Open Source Software Archive

Member "gamgi0.17.5x/src/gtk/atom/gamgi_gtk_atom_config.c" (23 Feb 2022, 37433 Bytes) of package /linux/misc/gamgi-all-0.17.5x.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /***********************************************
    2  *
    3  * $GAMGI/src/gtk/atom/gamgi_gtk_atom_config.c
    4  *
    5  * Copyright (C) 2004 Carlos Pereira
    6  *
    7  * Distributed under the terms of the GNU
    8  * General Public License: $GAMGI/LICENSE
    9  *
   10  */
   11 
   12 #include "gamgi_engine.h"
   13 #include "gamgi_gtk.h"
   14 #include "gamgi_mesa.h"
   15 #include "gamgi_chem.h"
   16 #include "gamgi_math.h"
   17 #include "gamgi_io.h"
   18 #include "gamgi_global.h"
   19 
   20 #include "gamgi_gtk_dialog.h"
   21 #include "gamgi_gtk_atom_table.h"
   22 #include "gamgi_gtk_atom_property.h"
   23 #include "gamgi_mesa_atom.h"
   24 #include "gamgi_mesa_lists.h"
   25 #include "gamgi_mesa_draw.h"
   26 #include "gamgi_chem_atom.h"
   27 #include "gamgi_io_token.h"
   28 #include "gamgi_global_copy.h"
   29 #include "gamgi_global_remove.h"
   30 
   31 static void static_element (GtkWidget *widget, void *data);
   32 static void static_number (GtkWidget *widget, void *data);
   33 
   34 /************************ internal function *************************
   35  *                                                                  *
   36  *                          STATIC_DEFAULT                          *
   37  *                                                                  *
   38  * This call is executed everytime element name or number entries   *
   39  * change. If the element name or number is recognized, the default *
   40  * values are shown. Otherwise, these entries are cleaned up.       *
   41  *                                                                  *
   42  ********************************************************************/
   43 
   44 static void static_default (int number, char *name, gamgi_window *window)
   45 {
   46 GtkWidget *dialog = window->dialog0;
   47 GtkWidget *entry_mass, *entry_radius;
   48 GtkWidget *entry_red, *entry_green, *entry_blue;
   49 char token[GAMGI_ENGINE_TOKEN];
   50 double radius;
   51 
   52 entry_mass = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_mass");
   53 entry_radius = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_radius");
   54 
   55 entry_red = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_red");
   56 entry_green = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_green");
   57 entry_blue = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_blue");
   58 
   59 if (number >= 0)
   60   {
   61   /****************************************************
   62    * A valid element was found: output default values *
   63    ****************************************************/
   64 
   65   /***********************
   66    *          Mass       *
   67    *                     *
   68    * Radius (if defined) *
   69    ***********************/
   70 
   71   sprintf (token, "%.*f", gamgi->gamgi->mass, gamgi->atom->mass[number]);
   72   gtk_entry_set_text (GTK_ENTRY (entry_mass), token);
   73 
   74   radius = gamgi->atom->radius[number];
   75   if (radius > 0)
   76     {
   77     sprintf (token, "%.*f", gamgi->gamgi->length, radius);
   78     gtk_entry_set_text (GTK_ENTRY (entry_radius), token);
   79     }
   80   else gtk_entry_set_text (GTK_ENTRY (entry_radius), "");
   81 
   82   /***************
   83    * R,G,B color *
   84    ***************/
   85 
   86   sprintf (token, "%.*f", GAMGI_MATH_DECIMAL_COLOR, gamgi->atom->red[number]);
   87   gtk_entry_set_text (GTK_ENTRY (entry_red), token);
   88   sprintf (token, "%.*f", GAMGI_MATH_DECIMAL_COLOR, gamgi->atom->green[number]);
   89   gtk_entry_set_text (GTK_ENTRY (entry_green), token);
   90   sprintf (token, "%.*f", GAMGI_MATH_DECIMAL_COLOR, gamgi->atom->blue[number]);
   91   gtk_entry_set_text (GTK_ENTRY (entry_blue), token);
   92   }
   93 else
   94   {
   95   /****************************************
   96    * The element is not defined: clean    *
   97    * everything related with the element. *
   98    ****************************************/
   99 
  100   gtk_entry_set_text (GTK_ENTRY (entry_mass), "");
  101   gtk_entry_set_text (GTK_ENTRY (entry_radius), "");
  102 
  103   gtk_entry_set_text (GTK_ENTRY (entry_red), "");
  104   gtk_entry_set_text (GTK_ENTRY (entry_green), "");
  105   gtk_entry_set_text (GTK_ENTRY (entry_blue), "");
  106   }
  107 
  108 }
  109 
  110 static void static_element (GtkWidget *widget, void *data)
  111 {
  112 gamgi_window *window = GAMGI_CAST_WINDOW data;
  113 GtkWidget *dialog = window->dialog0;
  114 GtkWidget *entry;
  115 const char *name;
  116 char token[GAMGI_ENGINE_TOKEN];
  117 int number;
  118 
  119 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_number");
  120 
  121 /**************************************************
  122  * block changed signal for number entry as       *
  123  * changes done in this function to that entry    *
  124  * should not be used to change name entry again! *
  125  **************************************************/
  126 
  127 g_signal_handlers_block_by_func (entry, static_number, window);
  128 
  129 /************************************
  130  * get name, get number, set number *
  131  ************************************/
  132 
  133 name = gtk_entry_get_text (GTK_ENTRY (widget));
  134 if (gamgi_io_token_alpha_scan (name, token,
  135 GAMGI_IO_TEXT, GAMGI_ENGINE_TOKEN) == TRUE &&
  136 gamgi_chem_atom_number (token, &number) == TRUE)
  137   {
  138   static_default (number, token, window);
  139   sprintf (token, "%d", number);
  140   gtk_entry_set_text (GTK_ENTRY (entry), token);
  141   }
  142 else
  143   {
  144   static_default (-1, NULL, window);
  145   gtk_entry_set_text (GTK_ENTRY (entry), "");
  146   }
  147 
  148 /**************************************************
  149  * unblock changed signal for number entry, so it *
  150  * accepts changes done directly in that entry    *
  151  **************************************************/
  152 
  153 g_signal_handlers_unblock_by_func (entry, static_number, window);
  154 }
  155 
  156 static void static_number (GtkWidget *widget, void *data)
  157 {
  158 gamgi_window *window = GAMGI_CAST_WINDOW data;
  159 GtkWidget *dialog = window->dialog0;
  160 GtkWidget *entry;
  161 const char *name;
  162 char token[GAMGI_ENGINE_TOKEN];
  163 int number;
  164 
  165 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_element");
  166 
  167 /********************************************
  168  * block changed signal for name entry so   *
  169  * changes done here to that entry will not *
  170  * be used to change number entry again!    *
  171  ********************************************/
  172 
  173 g_signal_handlers_block_by_func (entry, static_element, window);
  174 
  175 /**********************************
  176  * get number, get name, set name *
  177  **********************************/
  178 
  179 name = gtk_entry_get_text (GTK_ENTRY (widget));
  180 if (gamgi_io_token_int_scan (name, &number,
  181 0, GAMGI_CHEM_ATOM_MAX) == TRUE)
  182   {
  183   gamgi_chem_atom_name (number, token);
  184   static_default (number, token, window);
  185   gtk_entry_set_text (GTK_ENTRY (entry), token);
  186   }
  187 else
  188   {
  189   static_default (-1, NULL, window);
  190   gtk_entry_set_text (GTK_ENTRY (entry), "");
  191   }
  192 
  193 /************************************************
  194  * unblock changed signal for name entry, so it *
  195  * accepts changes done directly in that entry  *
  196  ************************************************/
  197 
  198 g_signal_handlers_unblock_by_func (entry, static_element, window);
  199 }
  200 
  201 static void static_button (GtkWidget *dialog, char *string)
  202 {
  203 GtkWidget *button;
  204 
  205 button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), string);
  206 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
  207 }
  208 
  209 /******************** internal function ****************
  210  *                                                     *
  211  *                       STATIC_SWITCH                 *
  212  *                                                     *
  213  *                                                     *
  214  *******************************************************/
  215 
  216 static void static_switch (GtkNotebook *notebook,
  217 GtkNotebookPage *page, int tag, void *data)
  218 {
  219 gamgi_window *window = GAMGI_CAST_WINDOW data;
  220 GtkWidget *dialog = window->dialog0;
  221 
  222 if (window->dialog1 != NULL)
  223   {
  224   /*********************************************************
  225    * close second level dialogs when notebook page changes *
  226    *********************************************************/
  227 
  228   static_button (dialog, "button_table");
  229   static_button (dialog, "button_mass");
  230   static_button (dialog, "button_radius");
  231   }
  232 
  233 }
  234 
  235 /**************** internal function ***************
  236  *                                                *
  237  *                   STATIC_TABLE                 *
  238  *                                                *
  239  * Launch or remove a second dialog containing    *
  240  * a Periodic Table and a Cancel button. This     *
  241  * call back function is executed when the user   *
  242  * presses either the Table button in the Atom    *
  243  * Create dialog (level one) or the Cancel button *
  244  * in the Periodic Table dialog (level two).      *
  245  *                                                *
  246  **************************************************/
  247 
  248 static void static_table (GtkWidget *widget, void *data)
  249 {
  250 gamgi_window *window = GAMGI_CAST_WINDOW data;
  251 GtkWidget *dialog = window->dialog0;
  252 GtkWidget *button;
  253 
  254 button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_table");
  255 
  256 /**************************
  257  * Create Periodic Table. *
  258  **************************/
  259 
  260 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) == TRUE)
  261   gamgi_gtk_atom_table (widget, window);
  262 
  263 /**************************
  264  * Remove Periodic Table. *
  265  **************************/
  266 
  267 else gamgi_gtk_dialog_task1_remove (widget, window);
  268 }
  269 
  270 /************ internal function **********
  271  *                                       *
  272  *               STATIC_OK               *
  273  *                                       *
  274  *                                       *
  275  *****************************************/
  276 
  277 static void static_ok (GtkWidget *widget, void *data)
  278 {
  279 gamgi_window *window = GAMGI_CAST_WINDOW data;
  280 GtkWidget *dialog = window->dialog0;
  281 gamgi_atom_class *atom_class, *atom_class_old;
  282 GtkWidget *combo;
  283 GtkWidget *entry;
  284 double mass, radius;
  285 float red, green, blue;
  286 int element, color = 0;
  287 const char *name;
  288 int row;
  289 
  290 atom_class = gamgi_global_copy_atom (gamgi->atom);
  291 
  292 /**********************************************************************
  293  * get Element default parameters: element,mass,radius,red,green,blue *
  294  **********************************************************************/
  295 
  296 /***********
  297  * element *
  298  ***********/
  299 
  300 element = -1;
  301 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_number");
  302 name = gtk_entry_get_text (GTK_ENTRY (entry));
  303 if (gamgi_io_token_check (name) == TRUE &&
  304 gamgi_io_token_int_scan (name, &element, 0, GAMGI_CHEM_ATOM_MAX) == FALSE)
  305   {
  306   gamgi_gtk_dialog_message_create ("Error", "Invalid element", window);
  307   gamgi_global_remove_atom (atom_class);
  308   return;
  309   }
  310 
  311 /***************
  312  * mass,radius *
  313  ***************/
  314 
  315 mass = -1.0;
  316 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_mass");
  317 name = gtk_entry_get_text (GTK_ENTRY (entry));
  318 if (gamgi_io_token_check (name) == TRUE &&
  319 gamgi_io_token_double_scan (name, &mass, 
  320 GAMGI_MATH_TOLERANCE_MASS, DBL_MAX) == FALSE)
  321   {
  322   gamgi_gtk_dialog_message_create ("Error", "Invalid mass", window);
  323   gamgi_global_remove_atom (atom_class);
  324   return;
  325   }
  326 
  327 radius = -1.0;
  328 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_radius");
  329 name = gtk_entry_get_text (GTK_ENTRY (entry));
  330 if (gamgi_io_token_check (name) == TRUE &&
  331 gamgi_io_token_double_scan (name, &radius, 
  332 GAMGI_MATH_TOLERANCE_LENGTH, DBL_MAX) == FALSE)
  333   {
  334   gamgi_gtk_dialog_message_create ("Error", "Invalid radius", window);
  335   gamgi_global_remove_atom (atom_class);
  336   return;
  337   }
  338 
  339  /******************
  340  * red,green,blue *
  341  ******************/
  342 
  343 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_red");
  344 name = gtk_entry_get_text (GTK_ENTRY (entry));
  345 if (gamgi_io_token_check (name) == TRUE)
  346   {
  347   color++;
  348   if (gamgi_io_token_float_scan (name, &red, 0.0, 1.0) == FALSE)
  349     {
  350     gamgi_gtk_dialog_message_create ("Error", "Invalid color", window);
  351     gamgi_global_remove_atom (atom_class);
  352     return;
  353     }
  354   }
  355 
  356 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_green");
  357 name = gtk_entry_get_text (GTK_ENTRY (entry));
  358 if (gamgi_io_token_check (name) == TRUE)
  359   {
  360   color++;
  361   if (gamgi_io_token_float_scan (name, &green, 0.0, 1.0) == FALSE)
  362     {
  363     gamgi_gtk_dialog_message_create ("Error", "Invalid color", window);
  364     gamgi_global_remove_atom (atom_class);
  365     return;
  366     }
  367   }
  368 
  369 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_blue");
  370 name = gtk_entry_get_text (GTK_ENTRY (entry));
  371 if (gamgi_io_token_check (name) == TRUE)
  372   {
  373   color++;
  374   if (gamgi_io_token_float_scan (name, &blue, 0.0, 1.0) == FALSE)
  375     {
  376     gamgi_gtk_dialog_message_create ("Error", "Invalid color", window);
  377     gamgi_global_remove_atom (atom_class);
  378     return;
  379     }
  380   }
  381  
  382 /************************************************
  383  * get Analysis default parameters: temperature *
  384  ************************************************/
  385 
  386 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_temperature");
  387 name = gtk_entry_get_text (GTK_ENTRY (entry));
  388 if (gamgi_io_token_double_scan (name, &atom_class->temperature, 0.0, DBL_MAX) == FALSE)
  389   {
  390   gamgi_gtk_dialog_message_create ("Error", "Invalid temperature", window);
  391   gamgi_global_remove_atom (atom_class);
  392   return;
  393   }
  394 
  395 /********************************************************
  396  * get View default parameters: style,size,variancy,min *
  397  ********************************************************/
  398 
  399 combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_style");
  400 row = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
  401 if (row == GAMGI_MESA_WIRED - 1) atom_class->draw = gamgi_mesa_atom_draw_cross;
  402 if (row == GAMGI_MESA_SOLID - 1) atom_class->draw = gamgi_mesa_atom_draw_sphere;
  403 
  404 combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_size");
  405 entry = gtk_bin_get_child (GTK_BIN (combo));
  406 name = gtk_entry_get_text (GTK_ENTRY (entry));
  407 if (gamgi_io_token_float_scan (name, &atom_class->size,
  408 GAMGI_MATH_TOLERANCE, FLT_MAX) == FALSE)
  409   {
  410   gamgi_gtk_dialog_message_create ("Error", "Invalid size", window);
  411   gamgi_global_remove_atom (atom_class);
  412   return;
  413   }
  414 
  415 combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_variancy");
  416 entry = gtk_bin_get_child (GTK_BIN (combo));
  417 name = gtk_entry_get_text (GTK_ENTRY (entry));
  418 if (gamgi_io_token_float_scan (name, &atom_class->variancy,
  419 0.0, FLT_MAX) == FALSE)
  420   {
  421   gamgi_gtk_dialog_message_create ("Error", "Invalid variancy", window);
  422   gamgi_global_remove_atom (atom_class);
  423   return;
  424   }
  425 
  426 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_min");
  427 name = gtk_entry_get_text (GTK_ENTRY (entry));
  428 if (gamgi_io_token_double_scan (name, &atom_class->min,
  429 GAMGI_MATH_TOLERANCE_LENGTH, DBL_MAX) == FALSE)
  430   {
  431   gamgi_gtk_dialog_message_create ("Error", "Invalid minimum radius", window);
  432   gamgi_global_remove_atom (atom_class);
  433   return;
  434   }
  435 
  436 /******************************************************************************
  437  * get Global parameters: slices (for solid spheres), width (for wired lines) *
  438  ******************************************************************************/
  439 
  440 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_slices");
  441 name = gtk_entry_get_text (GTK_ENTRY (entry));
  442 if (gamgi_io_token_int_scan (name, &atom_class->slices,
  443 GAMGI_MESA_ATOM_SLICES_MIN, GAMGI_MESA_ATOM_SLICES_MAX) == FALSE)
  444   {
  445   gamgi_gtk_dialog_message_create ("Error", "Invalid slices", window);
  446   gamgi_global_remove_atom (atom_class);
  447   return;
  448   }
  449 
  450 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_width");
  451 name = gtk_entry_get_text (GTK_ENTRY (entry));
  452 if (gamgi_io_token_int_scan (name, &atom_class->width,
  453 GAMGI_MESA_ATOM_WIDTH_MIN, GAMGI_MESA_ATOM_WIDTH_MAX) == FALSE)
  454   {
  455   gamgi_gtk_dialog_message_create ("Error", "Invalid line width", window);
  456   gamgi_global_remove_atom (atom_class);
  457   return;
  458   }
  459 
  460 /*************************************************************
  461  * red,green,blue are coupled parameters: define all or none *
  462  *************************************************************/
  463 
  464 if (color == 1 || color == 2)
  465   {
  466   gamgi_gtk_dialog_message_create ("Error", "Invalid color", window);
  467   gamgi_global_remove_atom (atom_class);
  468   return;
  469   }
  470 
  471 /******************************
  472  * properties without element *
  473  ******************************/
  474 
  475 if (element == -1 && (mass != -1.0 || radius != -1.0 || color != 0))
  476   {
  477   gamgi_gtk_dialog_message_create ("Error", "Invalid element data", window);
  478   gamgi_global_remove_atom (atom_class);
  479   return;
  480   }
  481 
  482 /******************************
  483  * element without properties *
  484  ******************************/
  485 
  486 if (element != -1 && (mass == -1.0 && radius == -1.0 && color == 0))
  487   {
  488   gamgi_gtk_dialog_message_create ("Error", "Invalid element data", window);
  489   gamgi_global_remove_atom (atom_class);
  490   return;
  491   }
  492 
  493 /************************************************
  494  * set element properties, after validity tests *
  495  ************************************************/
  496 
  497 if (mass != -1.0) atom_class->mass[element] = mass;
  498 if (radius != -1.0) atom_class->radius[element] = radius;
  499 if (color == 3)
  500   {
  501   atom_class->red[element] = red;
  502   atom_class->green[element] = green;
  503   atom_class->blue[element] = blue;
  504   }
  505   
  506 /******************************************
  507  * recreate OpenGL pre-compiled shared    *
  508  * lists with the new width/slices values *
  509  ******************************************/
  510 
  511 if (atom_class->width != gamgi->atom->width)
  512   {
  513   gamgi_mesa_lists_cross (atom_class->width);
  514   gamgi_mesa_lists_line (atom_class->width);
  515   }
  516 
  517 if (atom_class->slices != gamgi->atom->slices)
  518   {
  519   gamgi_mesa_lists_sphere (atom_class->slices, atom_class->slices);
  520   gamgi_mesa_lists_cylinder_1 (atom_class->slices, 1);
  521   gamgi_mesa_lists_cylinder_3 (atom_class->slices, 1);
  522   gamgi_mesa_lists_cylinder_5 (atom_class->slices, 1);
  523   }
  524 
  525 /*******************************************************
  526  * unsetting the old class object before removing it   *
  527  * is marginally better because this way the official  *
  528  * object address is always occupied by a valid object *
  529  *******************************************************/
  530 
  531 atom_class_old = gamgi->atom;
  532 gamgi->atom = atom_class;
  533 gamgi_global_remove_atom (atom_class_old);
  534 
  535 /*****************************************************
  536  *    Remove dialog and redraw ALL top windows       *
  537  * (because of global parameters: slices,size,width) *
  538  *****************************************************/
  539 
  540 gamgi_gtk_dialog_task0_remove (widget, window);
  541 gamgi_mesa_draw_gamgi ();
  542 }
  543 
  544 static void static_init (gamgi_window *window)
  545 {
  546 gamgi_atom_class *atom_class = gamgi->atom;
  547 GtkWidget *dialog = window->dialog0;
  548 GtkWidget *combo;
  549 GtkWidget *entry;
  550 char token[GAMGI_ENGINE_TOKEN];
  551 
  552 /**************************
  553  * initialize temperature *
  554  **************************/
  555 
  556 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_temperature");
  557 sprintf (token, "%.*f", GAMGI_MATH_DECIMAL_OCCUPANCY, atom_class->temperature);
  558 gtk_entry_set_text (GTK_ENTRY (entry), token);
  559 
  560 /************************************
  561  * initialize style, size, variancy *
  562  ************************************/
  563 
  564 combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_style");
  565 if (atom_class->draw == gamgi_mesa_atom_draw_cross)
  566   gtk_combo_box_set_active (GTK_COMBO_BOX (combo), GAMGI_MESA_WIRED - 1);
  567 if (atom_class->draw == gamgi_mesa_atom_draw_sphere)
  568   gtk_combo_box_set_active (GTK_COMBO_BOX (combo), GAMGI_MESA_SOLID - 1);
  569 
  570 combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_size");
  571 sprintf (token, "%.*f", GAMGI_MATH_DECIMAL_SIZE, atom_class->size);
  572 entry = gtk_bin_get_child (GTK_BIN (combo));
  573 gtk_entry_set_text (GTK_ENTRY (entry), token);
  574 
  575 combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_variancy");
  576 sprintf (token, "%.*f", GAMGI_MATH_DECIMAL_VARIANCY, atom_class->variancy);
  577 entry = gtk_bin_get_child (GTK_BIN (combo));
  578 gtk_entry_set_text (GTK_ENTRY (entry), token);
  579 
  580 /********************************************
  581  * initialise minimum radius, slices, width *
  582  ********************************************/
  583 
  584 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_min");
  585 sprintf (token, "%.*f", gamgi->gamgi->length, atom_class->min);
  586 gtk_entry_set_text (GTK_ENTRY (entry), token);
  587 
  588 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_slices");
  589 sprintf (token, "%d", atom_class->slices);
  590 gtk_entry_set_text (GTK_ENTRY (entry), token);
  591 
  592 entry = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_width");
  593 sprintf (token, "%d", atom_class->width);
  594 gtk_entry_set_text (GTK_ENTRY (entry), token);
  595 }
  596 
  597 void gamgi_gtk_atom_config (GtkWidget *widget, void *data)
  598 {
  599 gamgi_window *window = GAMGI_CAST_WINDOW data;
  600 GtkWidget *dialog;
  601 GtkWidget *notebook;
  602 GtkWidget *button;
  603 GtkWidget *label;
  604 GtkWidget *entry;
  605 GtkWidget *table;
  606 GtkWidget *hbox_center, *hbox_left, *hbox_left_left;
  607 GtkWidget *vbox_dialog, *vbox_page, *vbox_center, *vbox_top;
  608 GtkWidget *combo;
  609 GtkListStore *store;
  610 GtkCellRenderer *renderer;
  611 GtkTreeIter iter;
  612 char token[GAMGI_ENGINE_TOKEN];
  613 
  614 /******************
  615  * Dialog level 0 *
  616  ******************/
  617 
  618 dialog = gamgi_gtk_dialog_task0_create ("Atom Config", window);
  619 window->action = GAMGI_GTK_ATOM_CONFIG;
  620 gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
  621 
  622 /********************
  623  * global container *
  624  ********************/
  625 
  626 vbox_dialog = gtk_vbox_new (FALSE, 5);
  627 gtk_container_add (GTK_CONTAINER (dialog), vbox_dialog);
  628 gtk_widget_show (vbox_dialog);
  629 
  630 /************
  631  * notebook *
  632  ************/
  633 
  634 notebook = gtk_notebook_new ();
  635 gtk_box_pack_start (GTK_BOX (vbox_dialog), notebook, FALSE, FALSE, 0);
  636 gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
  637 g_signal_connect (notebook, "switch_page",
  638 G_CALLBACK (static_switch), window);
  639 g_object_set_data (G_OBJECT (dialog), "notebook", notebook);
  640 gtk_widget_show (notebook);
  641 
  642 /*************
  643  * Type page *
  644  *************/
  645 
  646 vbox_page = gtk_vbox_new (FALSE, 5);
  647 label = gtk_label_new (" Type ");
  648 gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox_page, label);
  649 gtk_container_set_border_width (GTK_CONTAINER (vbox_page), 10);
  650 gtk_widget_show (vbox_page);
  651 
  652 vbox_center = gtk_vbox_new (TRUE, 0);
  653 gtk_box_pack_start (GTK_BOX (vbox_page), vbox_center, TRUE, TRUE, 0);
  654 gtk_widget_show (vbox_center);
  655 
  656 vbox_top = gtk_vbox_new (FALSE, 10);
  657 gtk_box_pack_start (GTK_BOX (vbox_center), vbox_top, FALSE, FALSE, 0);
  658 gtk_widget_show (vbox_top);
  659 
  660 /**************************
  661  * element, number, table *
  662  **************************/
  663 
  664 hbox_center = gtk_hbox_new (TRUE, 0);
  665 gtk_box_pack_start (GTK_BOX (vbox_top), hbox_center, FALSE, FALSE, 0);
  666 gtk_widget_show (hbox_center);
  667 
  668 hbox_left = gtk_hbox_new (FALSE, 15);
  669 gtk_box_pack_start (GTK_BOX (hbox_center), hbox_left, FALSE, FALSE, 0);
  670 gtk_widget_show (hbox_left);
  671 
  672 hbox_left_left = gtk_hbox_new (FALSE, 5);
  673 gtk_box_pack_start (GTK_BOX (hbox_left), hbox_left_left, FALSE, FALSE, 0);
  674 gtk_widget_show (hbox_left_left);
  675 
  676 label = gtk_label_new ("Element");
  677 gtk_box_pack_start (GTK_BOX (hbox_left_left), label, FALSE, FALSE, 0);
  678 gtk_widget_show (label);
  679 
  680 entry = gtk_entry_new ();
  681 gtk_box_pack_start (GTK_BOX (hbox_left_left), entry, FALSE, FALSE, 0);
  682 gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_3);
  683 gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_3);
  684 g_signal_connect (entry, "changed",
  685 G_CALLBACK (static_element), window);
  686 g_object_set_data (G_OBJECT (dialog), "entry_element", entry);
  687 gtk_widget_show (entry);
  688 
  689 hbox_left_left = gtk_hbox_new (FALSE, 5);
  690 gtk_box_pack_start (GTK_BOX (hbox_left), hbox_left_left, FALSE, FALSE, 0);
  691 gtk_widget_show (hbox_left_left);
  692 
  693 label = gtk_label_new ("Number");
  694 gtk_box_pack_start (GTK_BOX (hbox_left_left), label, FALSE, FALSE, 0);
  695 gtk_widget_show (label);
  696 
  697 entry = gtk_entry_new ();
  698 gtk_box_pack_start (GTK_BOX (hbox_left_left), entry, FALSE, FALSE, 0);
  699 gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_3);
  700 gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_3);
  701 g_signal_connect (entry, "changed",
  702 G_CALLBACK (static_number), window);
  703 g_object_set_data (G_OBJECT (dialog), "entry_number", entry);
  704 gtk_widget_show (entry);
  705 
  706 button = gtk_toggle_button_new_with_label ("Table");
  707 gtk_box_pack_end (GTK_BOX (hbox_left), button, FALSE, FALSE, 0);
  708 g_signal_connect (button, "toggled",
  709 G_CALLBACK (static_table), window);
  710 g_object_set_data (G_OBJECT (dialog), "button_table", button);
  711 gtk_widget_show (button);
  712 
  713 /****************
  714  * mass, radius *
  715  ****************/
  716 
  717 hbox_center = gtk_hbox_new (TRUE, 0);
  718 gtk_box_pack_start (GTK_BOX (vbox_top), hbox_center, FALSE, FALSE, 0);
  719 gtk_widget_show (hbox_center);
  720 
  721 hbox_left = gtk_hbox_new (FALSE, 20);
  722 gtk_box_pack_start (GTK_BOX (hbox_center), hbox_left, FALSE, FALSE, 0);
  723 gtk_widget_show (hbox_left);
  724 
  725 hbox_left_left = gtk_hbox_new (FALSE, 5);
  726 gtk_box_pack_start (GTK_BOX (hbox_left), hbox_left_left, FALSE, FALSE, 0);
  727 gtk_widget_show (hbox_left_left);
  728 
  729 label = gtk_label_new ("Mass");
  730 gtk_box_pack_start (GTK_BOX (hbox_left_left), label, FALSE, FALSE, 0);
  731 gtk_widget_show (label);
  732 
  733 entry = gtk_entry_new ();
  734 gtk_box_pack_start (GTK_BOX (hbox_left_left), entry, FALSE, FALSE, 0);
  735 gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
  736 gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
  737 g_object_set_data (G_OBJECT (dialog), "entry_mass", entry);
  738 gtk_widget_show (entry);
  739 
  740 button = gtk_toggle_button_new_with_label ("List");
  741 gtk_box_pack_start (GTK_BOX (hbox_left_left), button, FALSE, FALSE, 0);
  742 g_signal_connect (button, "clicked",
  743 G_CALLBACK (gamgi_gtk_atom_property_mass), window);
  744 g_object_set_data (G_OBJECT (dialog), "button_mass", button);
  745 gtk_widget_show (button);
  746 
  747 hbox_left_left = gtk_hbox_new (FALSE, 5);
  748 gtk_box_pack_start (GTK_BOX (hbox_left), hbox_left_left, FALSE, FALSE, 0);
  749 gtk_widget_show (hbox_left_left);
  750 
  751 label = gtk_label_new ("Radius");
  752 gtk_box_pack_start (GTK_BOX (hbox_left_left), label, FALSE, FALSE, 0);
  753 gtk_widget_show (label);
  754 
  755 entry = gtk_entry_new ();
  756 gtk_box_pack_start (GTK_BOX (hbox_left_left), entry, FALSE, FALSE, 0);
  757 gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
  758 gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
  759 g_object_set_data (G_OBJECT (dialog), "entry_radius", entry);
  760 gtk_widget_show (entry);
  761 
  762 button = gtk_toggle_button_new_with_label ("List");
  763 gtk_box_pack_start (GTK_BOX (hbox_left_left), button, FALSE, FALSE, 0);
  764 g_signal_connect (button, "clicked",
  765 G_CALLBACK (gamgi_gtk_atom_property_radius), window);
  766 g_object_set_data (G_OBJECT (dialog), "button_radius", button);
  767 gtk_widget_show (button);
  768 
  769 /*********
  770  * color *
  771  *********/
  772 
  773 hbox_center = gtk_hbox_new (TRUE, 0);
  774 gtk_box_pack_start (GTK_BOX (vbox_top), hbox_center, FALSE, FALSE, 0);
  775 gtk_widget_show (hbox_center);
  776 
  777 table = gtk_table_new (1, 7, FALSE);
  778 gtk_box_pack_start (GTK_BOX (hbox_center), table, FALSE, FALSE, 0);
  779 gtk_widget_show (table);
  780 
  781 label = gtk_label_new ("Color");
  782 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
  783 gtk_widget_show (label);
  784 
  785 label = gtk_label_new ("R");
  786 gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, GTK_EXPAND, GTK_FILL, 5, 0);
  787 gtk_widget_show (label);
  788 
  789 label = gtk_label_new ("G");
  790 gtk_table_attach (GTK_TABLE (table), label, 4, 5, 0, 1, GTK_EXPAND, GTK_FILL, 5, 0);
  791 gtk_widget_show (label);
  792 
  793 label = gtk_label_new ("B");
  794 gtk_table_attach (GTK_TABLE (table), label, 6, 7, 0, 1, GTK_EXPAND, GTK_FILL, 5, 0);
  795 gtk_widget_show (label);
  796 
  797 entry = gtk_entry_new ();
  798 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1, GTK_EXPAND, GTK_FILL, 5, 0);
  799 gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
  800 gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
  801 g_object_set_data (G_OBJECT (dialog), "entry_red", entry);
  802 gtk_widget_show (entry);
  803 
  804 entry = gtk_entry_new ();
  805 gtk_table_attach (GTK_TABLE (table), entry, 3, 4, 0, 1, GTK_EXPAND, GTK_FILL, 5, 0);
  806 gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
  807 gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
  808 g_object_set_data (G_OBJECT (dialog), "entry_green", entry);
  809 gtk_widget_show (entry);
  810 
  811 entry = gtk_entry_new ();
  812 gtk_table_attach (GTK_TABLE (table), entry, 5, 6, 0, 1, GTK_EXPAND, GTK_FILL, 5, 0);
  813 gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
  814 gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
  815 g_object_set_data (G_OBJECT (dialog), "entry_blue", entry);
  816 gtk_widget_show (entry);
  817  
  818 /*****************
  819  * Analysis page *
  820  *****************/
  821 
  822 vbox_page = gtk_vbox_new (FALSE, 5);
  823 label = gtk_label_new ("Analysis");
  824 gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox_page, label);
  825 gtk_container_set_border_width (GTK_CONTAINER (vbox_page), 10);
  826 gtk_widget_show (vbox_page);
  827 
  828 vbox_center = gtk_vbox_new (TRUE, 0);
  829 gtk_box_pack_start (GTK_BOX (vbox_page), vbox_center, TRUE, TRUE, 0);
  830 gtk_widget_show (vbox_center);
  831 
  832 /***************
  833  * temperature *
  834  ***************/
  835 
  836 hbox_center = gtk_hbox_new (TRUE, 0);
  837 gtk_box_pack_start (GTK_BOX (vbox_center), hbox_center, FALSE, FALSE, 0);
  838 gtk_widget_show (hbox_center);
  839 
  840 hbox_left = gtk_hbox_new (FALSE, 5);
  841 gtk_box_pack_start (GTK_BOX (hbox_center), hbox_left, FALSE, FALSE, 0);
  842 gtk_widget_show (hbox_left);
  843 
  844 label = gtk_label_new ("Temperature");
  845 gtk_box_pack_start (GTK_BOX (hbox_left), label, FALSE, FALSE, 0);
  846 gtk_widget_show (label);
  847 
  848 entry = gtk_entry_new ();
  849 gtk_box_pack_end (GTK_BOX (hbox_left), entry, FALSE, FALSE, 0);
  850 gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
  851 gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
  852 g_object_set_data (G_OBJECT (dialog), "entry_temperature", entry);
  853 gtk_widget_show (entry);
  854 
  855 /*************
  856  * View page *
  857  *************/
  858 
  859 vbox_page = gtk_vbox_new (FALSE, 5);
  860 label = gtk_label_new (" View ");
  861 gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox_page, label);
  862 gtk_container_set_border_width (GTK_CONTAINER (vbox_page), 10);
  863 gtk_widget_show (vbox_page);
  864 
  865 vbox_center = gtk_vbox_new (TRUE, 0);
  866 gtk_box_pack_start (GTK_BOX (vbox_page), vbox_center, TRUE, TRUE, 0);
  867 gtk_widget_show (vbox_center);
  868 
  869 hbox_center = gtk_hbox_new (TRUE, 0);
  870 gtk_box_pack_start (GTK_BOX (vbox_center), hbox_center, FALSE, FALSE, 0);
  871 gtk_widget_show (hbox_center);
  872 
  873 /***************
  874  * left column *
  875  ***************/
  876 
  877 vbox_top = gtk_vbox_new (TRUE, 15);
  878 gtk_box_pack_start (GTK_BOX (hbox_center), vbox_top, FALSE, FALSE, 0);
  879 gtk_widget_show (vbox_top);
  880 
  881 /*********
  882  * style *
  883  *********/
  884 
  885 hbox_left = gtk_hbox_new (FALSE, 5);
  886 gtk_box_pack_start (GTK_BOX (vbox_top), hbox_left, FALSE, FALSE, 0);
  887 gtk_widget_show (hbox_left);
  888 
  889 combo = gtk_combo_box_new ();
  890 gtk_box_pack_end (GTK_BOX (hbox_left), combo, FALSE, FALSE, 0);
  891 g_object_set_data (G_OBJECT (dialog), "combo_style", combo);
  892 gtk_widget_show (combo);
  893 
  894 store = gtk_list_store_new (1, G_TYPE_STRING);
  895 gtk_list_store_append (store, &iter);
  896 gtk_list_store_set (store, &iter, 0, "Wired", -1);
  897 gtk_list_store_append (store, &iter);
  898 gtk_list_store_set (store, &iter, 0, "Solid", -1);
  899 gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
  900 g_object_unref (store);
  901 
  902 renderer = gtk_cell_renderer_text_new ();
  903 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
  904 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, "text", 0, NULL);
  905 
  906 label = gtk_label_new ("Style");
  907 gtk_box_pack_end (GTK_BOX (hbox_left), label, FALSE, FALSE, 0);
  908 gtk_widget_show (label);
  909 
  910 /************
  911  * variancy *
  912  ************/
  913 
  914 hbox_left = gtk_hbox_new (FALSE, 5);
  915 gtk_box_pack_start (GTK_BOX (vbox_top), hbox_left, FALSE, FALSE, 0);
  916 gtk_widget_show (hbox_left);
  917 
  918 combo = gtk_combo_box_entry_new ();
  919 gtk_box_pack_end (GTK_BOX (hbox_left), combo, FALSE, FALSE, 0);
  920 entry = gtk_bin_get_child (GTK_BIN (combo));
  921 gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
  922 gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
  923 g_object_set_data (G_OBJECT (dialog), "combo_variancy", combo);
  924 gtk_widget_show (combo);
  925 
  926 store = gtk_list_store_new (1, G_TYPE_STRING);
  927 gtk_list_store_append (store, &iter);
  928 sprintf (token, "%.*f", GAMGI_MATH_DECIMAL_SCALE, 0.0);
  929 gtk_list_store_set (store, &iter, 0, token, -1);
  930 gtk_list_store_append (store, &iter);
  931 sprintf (token, "%.*f", GAMGI_MATH_DECIMAL_SCALE, 1.0);
  932 gtk_list_store_set (store, &iter, 0, token, -1);
  933 gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
  934 g_object_unref (store);
  935 
  936 gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (combo), 0);
  937 
  938 label = gtk_label_new ("Variancy");
  939 gtk_box_pack_end (GTK_BOX (hbox_left), label, FALSE, FALSE, 0);
  940 g_object_set_data (G_OBJECT (dialog), "label_variancy", label);
  941 gtk_widget_show (label);
  942 
  943 /****************
  944  * right column *
  945  ****************/
  946 
  947 vbox_top = gtk_vbox_new (TRUE, 15);
  948 gtk_box_pack_start (GTK_BOX (hbox_center), vbox_top, FALSE, FALSE, 0);
  949 gtk_widget_show (vbox_top);
  950 
  951 /********
  952  * size *
  953  ********/
  954 
  955 hbox_left = gtk_hbox_new (FALSE, 5);
  956 gtk_box_pack_start (GTK_BOX (vbox_top), hbox_left, FALSE, FALSE, 0);
  957 gtk_widget_show (hbox_left);
  958 
  959 combo = gtk_combo_box_entry_new ();
  960 gtk_box_pack_end (GTK_BOX (hbox_left), combo, FALSE, FALSE, 0);
  961 entry = gtk_bin_get_child (GTK_BIN (combo));
  962 gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
  963 gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_5);
  964 g_object_set_data (G_OBJECT (dialog), "combo_size", combo);
  965 gtk_widget_show (combo);
  966 
  967 store = gtk_list_store_new (1, G_TYPE_STRING);
  968 gtk_list_store_append (store, &iter);
  969 sprintf (token, "%.*f", GAMGI_MATH_DECIMAL_SCALE, 0.5);
  970 gtk_list_store_set (store, &iter, 0, token, -1);
  971 gtk_list_store_append (store, &iter);
  972 sprintf (token, "%.*f", GAMGI_MATH_DECIMAL_SCALE, 0.8);
  973 gtk_list_store_set (store, &iter, 0, token, -1);
  974 gtk_list_store_append (store, &iter);
  975 sprintf (token, "%.*f", GAMGI_MATH_DECIMAL_SCALE, 1.0);
  976 gtk_list_store_set (store, &iter, 0, token, -1);
  977 gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
  978 g_object_unref (store);
  979 
  980 gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (combo), 0);
  981 
  982 label = gtk_label_new ("Size");
  983 gtk_box_pack_end (GTK_BOX (hbox_left), label, FALSE, FALSE, 0);
  984 g_object_set_data (G_OBJECT (dialog), "label_size", label);
  985 gtk_widget_show (label);
  986 
  987 /**********************************
  988  * minimum radius (H, by default) *
  989  **********************************/
  990 
  991 hbox_left = gtk_hbox_new (FALSE, 5);
  992 gtk_box_pack_start (GTK_BOX (vbox_top), hbox_left, FALSE, FALSE, 0);
  993 gtk_widget_show (hbox_left);
  994 
  995 entry = gtk_entry_new ();
  996 gtk_box_pack_end (GTK_BOX (hbox_left), entry, FALSE, FALSE, 0);
  997 gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
  998 gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_7);
  999 g_object_set_data (G_OBJECT (dialog), "entry_min", entry);
 1000 gtk_widget_show (entry);
 1001 
 1002 label = gtk_label_new ("Min");
 1003 gtk_box_pack_end (GTK_BOX (hbox_left), label, FALSE, FALSE, 0);
 1004 gtk_widget_show (label);
 1005 
 1006 /***************
 1007  * Global page *
 1008  ***************/
 1009 
 1010 vbox_page = gtk_vbox_new (FALSE, 5);
 1011 label = gtk_label_new ("Global");
 1012 gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox_page, label);
 1013 gtk_container_set_border_width (GTK_CONTAINER (vbox_page), 10);
 1014 gtk_widget_show (vbox_page);
 1015 
 1016 vbox_center = gtk_vbox_new (TRUE, 0);
 1017 gtk_box_pack_start (GTK_BOX (vbox_page), vbox_center, TRUE, TRUE, 0);
 1018 gtk_widget_show (vbox_center);
 1019 
 1020 vbox_top = gtk_vbox_new (FALSE, 10);
 1021 gtk_box_pack_start (GTK_BOX (vbox_center), vbox_top, FALSE, FALSE, 0);
 1022 gtk_widget_show (vbox_top);
 1023 
 1024 /***************************
 1025  * variancy, slices, width *
 1026  ***************************/
 1027 
 1028 hbox_center = gtk_hbox_new (TRUE, 0);
 1029 gtk_box_pack_start (GTK_BOX (vbox_top), hbox_center, FALSE, FALSE, 0);
 1030 gtk_widget_show (hbox_center);
 1031 
 1032 hbox_left = gtk_hbox_new (FALSE, 15);
 1033 gtk_box_pack_start (GTK_BOX (hbox_center), hbox_left, FALSE, FALSE, 0);
 1034 gtk_widget_show (hbox_left);
 1035 
 1036 /******************************
 1037  * spherical/cylindric Slices *
 1038  ******************************/
 1039 
 1040 hbox_left_left = gtk_hbox_new (FALSE, 5);
 1041 gtk_box_pack_start (GTK_BOX (hbox_left), hbox_left_left, FALSE, FALSE, 0);
 1042 gtk_widget_show (hbox_left_left);
 1043 
 1044 label = gtk_label_new ("Slices");
 1045 gtk_box_pack_start (GTK_BOX (hbox_left_left), label, FALSE, FALSE, 0);
 1046 gtk_widget_show (label);
 1047 
 1048 entry = gtk_entry_new ();
 1049 gtk_box_pack_start (GTK_BOX (hbox_left_left), entry, FALSE, FALSE, 0);
 1050 gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_3);
 1051 gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_3);
 1052 g_object_set_data (G_OBJECT (dialog), "entry_slices", entry);
 1053 gtk_widget_show (entry);
 1054 
 1055 /**************
 1056  * line width *
 1057  **************/
 1058 
 1059 hbox_left_left = gtk_hbox_new (FALSE, 5);
 1060 gtk_box_pack_start (GTK_BOX (hbox_left), hbox_left_left, FALSE, FALSE, 0);
 1061 gtk_widget_show (hbox_left_left);
 1062 
 1063 label = gtk_label_new ("Width");
 1064 gtk_box_pack_start (GTK_BOX (hbox_left_left), label, FALSE, FALSE, 0);
 1065 gtk_widget_show (label);
 1066 
 1067 entry = gtk_entry_new ();
 1068 gtk_box_pack_start (GTK_BOX (hbox_left_left), entry, FALSE, FALSE, 0);
 1069 gtk_entry_set_width_chars (GTK_ENTRY (entry), GAMGI_GTK_CHAR_2);
 1070 gtk_entry_set_max_length (GTK_ENTRY (entry), GAMGI_GTK_CHAR_2);
 1071 g_object_set_data (G_OBJECT (dialog), "entry_width", entry);
 1072 gtk_widget_show (entry);
 1073 
 1074 /*********************
 1075  * Ok/Cancel buttons *
 1076  *********************/
 1077 
 1078 hbox_center = gtk_hbox_new (TRUE, 0);
 1079 gtk_box_pack_start (GTK_BOX (vbox_dialog), hbox_center, FALSE, FALSE, 0);
 1080 gtk_widget_show (hbox_center);
 1081 
 1082 button = gamgi_gtk_dialog_button_create ("Ok", NULL);
 1083 gtk_box_pack_start (GTK_BOX (hbox_center), button, FALSE, FALSE, 0);
 1084 gtk_widget_set_size_request (button, GAMGI_GTK_BUTTON_WIDTH, -1);
 1085 g_signal_connect (button, "clicked",
 1086 G_CALLBACK (static_ok), window);
 1087 gtk_widget_show (button);
 1088 
 1089 button = gamgi_gtk_dialog_button_create ("Cancel", "red");
 1090 gtk_box_pack_start (GTK_BOX (hbox_center), button, FALSE, FALSE, 0);
 1091 gtk_widget_set_size_request (button, GAMGI_GTK_BUTTON_WIDTH, -1);
 1092 gtk_widget_grab_focus (button);
 1093 g_signal_connect (button, "clicked",
 1094 G_CALLBACK (gamgi_gtk_dialog_task0_remove), window);
 1095 gtk_widget_show (button);
 1096 
 1097 static_init (window);
 1098 gtk_widget_show (dialog);
 1099 }