Пример #1
0
void
dialog_open_system_new (DialogOpenSystem * dlg)
{
  int i;
  char *name;
  GtkFileFilter *filter;
  System s[1];

  filter = gtk_file_filter_new ();
  gtk_file_filter_add_pattern (filter, "*.xml");
  gtk_file_filter_add_pattern (filter, "*.XML");
  gtk_file_filter_set_name (filter, gettext ("XML system file (*.xml, *.XML)"));
  dlg->button_open = (GtkFileChooserButton *) gtk_file_chooser_button_new
    (gettext ("Open system"), GTK_FILE_CHOOSER_ACTION_OPEN);
  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dlg->button_open), filter);
  gtk_file_chooser_set_filename
    (GTK_FILE_CHOOSER (dlg->button_open), string_system);

  dlg->window =
    (GtkDialog *) gtk_dialog_new_with_buttons (gettext ("Open system"),
                                               dialog_simulator->window,
                                               GTK_DIALOG_MODAL,
                                               gettext ("_OK"), GTK_RESPONSE_OK,
                                               gettext ("_Cancel"),
                                               GTK_RESPONSE_CANCEL, NULL);
  gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (dlg->window)),
                     GTK_WIDGET (dlg->button_open));
  gtk_widget_show (GTK_WIDGET (dlg->button_open));

  window_parent = (GtkWindow *) dlg->window;

  do
    {
      i = gtk_dialog_run (dlg->window);
      if (i == GTK_RESPONSE_OK)
        {
          name = gtk_file_chooser_get_filename
            (GTK_FILE_CHOOSER (dlg->button_open));
          if (name)
            {
              i = system_open_xml (s, g_path_get_basename (name),
                                   g_path_get_dirname (name));
            }
          else
            {
              i = 0;
              jbw_show_error2 (gettext ("Open system"),
                               gettext ("Unable to open the file"));
            }
          if (i)
            {
              g_free (string_system);
              string_system = jb_strdup (name);
              g_free (name);
              system_delete (sys);
              if (!system_copy (sys, s))
                {
                  jbw_show_error (message);
                  exit (0);
                }
              system_delete (s);
              if (!simulate_start ())
                continue;
              dialog_simulator_actualize_bar (dialog_simulator);
              dialog_simulator_actualize (dialog_simulator);
              break;
            }
          else
            g_free (name);
        }
      else
        break;
    }
  while (1);
  gtk_widget_destroy (GTK_WIDGET (dlg->window));

  window_parent = dialog_simulator->window;
}
Пример #2
0
DialogSimulator *
dialog_simulator_new ()
{
  register int i;
  register DialogSimulator *dlg;
  char *str_item_bar[N_DIALOG_SIMULATOR_ITEM_BAR] = { gettext ("_Channel"),
    gettext ("_Simulate"), gettext ("_Graphical"), gettext ("_Help")
  }, *str_item_system[N_DIALOG_SIMULATOR_ITEM_SYSTEM] =
  {
  gettext ("_New"),
      gettext ("_Open"), gettext ("_Edit"), gettext ("_Save"),
      gettext ("S_ave as"), NULL, gettext ("E_xit")},
    *str_item_simulate[N_DIALOG_SIMULATOR_ITEM_SIMULATE] =
  {
  gettext ("_Start"), gettext ("Sto_p"), NULL,
      gettext ("Conse_rvation error"), NULL,
      gettext ("Sa_ve solution"), gettext ("Save _graphical")},
    *str_item_graphic[N_DIALOG_SIMULATOR_ITEM_GRAPHIC] =
  {
  gettext ("_Options"),
      NULL, gettext ("_View animation"), gettext ("_Stop animation")},
    *str_item_help[N_DIALOG_SIMULATOR_ITEM_HELP] =
  {
  gettext ("_Help"), gettext ("_About")},
    *str_buttons[N_DIALOG_SIMULATOR_BUTTONS] =
  {
  gettext ("Exit"), NULL,
      gettext ("New system"), gettext ("Open system"),
      gettext ("Edit system"), gettext ("Save system"),
      gettext ("Save system as"), NULL, gettext ("Start simulation"),
      gettext ("Stop simulation"), gettext ("Conservation error"),
      gettext ("Save solution"), gettext ("Save graphical"), NULL,
      gettext ("Graphical options"), gettext ("View animation"),
      gettext ("Stop animation"), NULL, gettext ("Help"), gettext ("About")},
    *image_buttons[N_DIALOG_SIMULATOR_BUTTONS] =
  {
  "application-exit", NULL,
      "document-new", "document-open", "document-properties",
      "document-save", "document-save-as", NULL,
      "system-run", "process-stop",
      "dialog-information", "document-revert",
      "document-print", NULL,
      "preferences-system", "call-start",
      "call-stop", NULL, "help-browser", "help-about"};

  dlg = (DialogSimulator *) g_try_malloc (sizeof (DialogSimulator));
  if (!dlg)
    return 0;

  dlg->menu = (GtkMenuBar *) gtk_menu_bar_new ();
  for (i = 0; i < N_DIALOG_SIMULATOR_ITEM_BAR; ++i)
    {
      if (str_item_bar[i])
        dlg->item_bar[i] = (GtkMenuItem *) gtk_menu_item_new_with_mnemonic
          (str_item_bar[i]);
      else
        dlg->item_bar[i] = (GtkMenuItem *) gtk_separator_menu_item_new ();
      gtk_menu_shell_append (GTK_MENU_SHELL (dlg->menu),
                             GTK_WIDGET (dlg->item_bar[i]));
    }

  dlg->menu_system = (GtkMenu *) gtk_menu_new ();
  for (i = 0; i < N_DIALOG_SIMULATOR_ITEM_SYSTEM; ++i)
    {
      if (str_item_system[i])
        dlg->item_system[i] = (GtkMenuItem *) gtk_menu_item_new_with_mnemonic
          (str_item_system[i]);
      else
        dlg->item_system[i] = (GtkMenuItem *) gtk_separator_menu_item_new ();
      gtk_menu_shell_append (GTK_MENU_SHELL (dlg->menu_system),
                             GTK_WIDGET (dlg->item_system[i]));
    }
  gtk_menu_item_set_submenu (dlg->item_bar[0], GTK_WIDGET (dlg->menu_system));

  dlg->menu_simulate = (GtkMenu *) gtk_menu_new ();
  for (i = 0; i < N_DIALOG_SIMULATOR_ITEM_SIMULATE; ++i)
    {
      if (str_item_simulate[i])
        dlg->item_simulate[i] = (GtkMenuItem *)
          gtk_menu_item_new_with_mnemonic (str_item_simulate[i]);
      else
        dlg->item_simulate[i] = (GtkMenuItem *) gtk_separator_menu_item_new ();
      gtk_menu_shell_append (GTK_MENU_SHELL (dlg->menu_simulate),
                             GTK_WIDGET (dlg->item_simulate[i]));
    }
  gtk_menu_item_set_submenu (dlg->item_bar[1], GTK_WIDGET (dlg->menu_simulate));

  dlg->menu_graphic = (GtkMenu *) gtk_menu_new ();
  for (i = 0; i < N_DIALOG_SIMULATOR_ITEM_GRAPHIC; ++i)
    {
      if (str_item_graphic[i])
        dlg->item_graphic[i] = (GtkMenuItem *)
          gtk_menu_item_new_with_mnemonic (str_item_graphic[i]);
      else
        dlg->item_graphic[i] = (GtkMenuItem *) gtk_separator_menu_item_new ();
      gtk_menu_shell_append (GTK_MENU_SHELL (dlg->menu_graphic),
                             GTK_WIDGET (dlg->item_graphic[i]));
    }
  gtk_menu_item_set_submenu (dlg->item_bar[2], GTK_WIDGET (dlg->menu_graphic));

  dlg->menu_help = (GtkMenu *) gtk_menu_new ();
  for (i = 0; i < N_DIALOG_SIMULATOR_ITEM_HELP; ++i)
    {
      if (str_item_help[i])
        dlg->item_help[i] = (GtkMenuItem *) gtk_menu_item_new_with_mnemonic
          (str_item_help[i]);
      else
        dlg->item_help[i] = (GtkMenuItem *) gtk_separator_menu_item_new ();
      gtk_menu_shell_append (GTK_MENU_SHELL (dlg->menu_help),
                             GTK_WIDGET (dlg->item_help[i]));
    }
  gtk_menu_item_set_submenu (dlg->item_bar[3], GTK_WIDGET (dlg->menu_help));

  dlg->toolbar = (GtkToolbar *) gtk_toolbar_new ();
  for (i = 0; i < N_DIALOG_SIMULATOR_BUTTONS; ++i)
    {
      if (str_buttons[i])
        {
          dlg->button[i] = (GtkToolItem *) gtk_tool_button_new
            (gtk_image_new_from_icon_name
             (image_buttons[i], GTK_ICON_SIZE_SMALL_TOOLBAR), str_buttons[i]);
          gtk_widget_set_tooltip_text
            (GTK_WIDGET (dlg->button[i]), str_buttons[i]);
        }
      else
        dlg->button[i] = (GtkToolItem *) gtk_separator_tool_item_new ();
      gtk_toolbar_insert (dlg->toolbar, dlg->button[i], -1);
    }

  dlg->graphic = jbw_graphic_new (0, 6, 6, 6, draw_graphic);
  jbw_graphic_set_logo (dlg->graphic, "swigs.png");
  dlg->label_simulation
    = (GtkLabel *) gtk_label_new (gettext ("Simulation time"));
  dlg->progress_simulation = (GtkProgressBar *) gtk_progress_bar_new ();

  dlg->label_cpu = (GtkLabel *) gtk_label_new (gettext ("Computational time"));
  gtk_widget_set_sensitive (GTK_WIDGET (dlg->label_cpu), 0);
  dlg->entry_cpu = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg->label_error =
    (GtkLabel *) gtk_label_new (gettext ("Conservation error"));
  dlg->entry_error = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg->box_bar = (GtkGrid *) gtk_grid_new ();
  gtk_grid_attach (dlg->box_bar, GTK_WIDGET (dlg->label_simulation),
                   0, 0, 1, 1);
  gtk_grid_attach (dlg->box_bar, GTK_WIDGET (dlg->progress_simulation),
                   1, 0, 1, 1);
  gtk_grid_attach (dlg->box_bar, GTK_WIDGET (dlg->label_cpu), 2, 0, 1, 1);
  gtk_grid_attach (dlg->box_bar, GTK_WIDGET (dlg->entry_cpu), 3, 0, 1, 1);
  gtk_grid_attach (dlg->box_bar, GTK_WIDGET (dlg->label_error), 4, 0, 1, 1);
  gtk_grid_attach (dlg->box_bar, GTK_WIDGET (dlg->entry_error), 5, 0, 1, 1);

  dlg->button_bar = (GtkButton *) gtk_button_new ();
  gtk_container_add (GTK_CONTAINER (dlg->button_bar),
                     GTK_WIDGET (dlg->box_bar));
  gtk_widget_set_sensitive (GTK_WIDGET (dlg->button_bar), 0);

  dlg->box = (GtkGrid *) gtk_grid_new ();
  gtk_grid_attach (dlg->box, GTK_WIDGET (dlg->menu), 0, 0, 1, 1);
  gtk_grid_attach (dlg->box, GTK_WIDGET (dlg->toolbar), 0, 1, 1, 1);
  gtk_grid_attach (dlg->box, GTK_WIDGET (dlg->button_bar), 0, 2, 1, 1);

  dlg->pixbuf = gtk_image_get_pixbuf
    (GTK_IMAGE (gtk_image_new_from_file ("logo.png")));

  dlg->window = (GtkWindow *) gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (dlg->window, "SWIGS");
  gtk_window_set_icon (dlg->window, dlg->pixbuf);
  gtk_container_add (GTK_CONTAINER (dlg->window), GTK_WIDGET (dlg->box));
  gtk_widget_show_all (GTK_WIDGET (dlg->window));
#if JBW_GRAPHIC==JBW_GRAPHIC_GLUT
  g_signal_connect (dlg->window, "destroy", glutLeaveMainLoop, NULL);
#else
  g_signal_connect (dlg->window, "destroy", gtk_main_quit, NULL);
#endif

  g_signal_connect
    (dlg->item_system[0], "activate", dialog_simulator_new_system, 0);
  g_signal_connect_swapped (dlg->item_system[1], "activate",
                            (void (*)) dialog_open_system_new,
                            dialog_open_system);
  g_signal_connect (dlg->item_system[2], "activate", dialog_simulator_edit, 0);
  g_signal_connect_swapped
    (dlg->item_system[3], "activate", (void (*)) system_save_xml, sys);
  g_signal_connect
    (dlg->item_system[4], "activate", dialog_simulator_save_as, 0);
  g_signal_connect (dlg->item_system[6], "activate", (void (*)) exit, 0);
  g_signal_connect_swapped (dlg->item_simulate[0], "activate",
                            (void (*)) dialog_simulator_start, dlg);
  g_signal_connect
    (dlg->item_simulate[1], "activate", dialog_simulator_stop, 0);
  g_signal_connect
    (dlg->item_simulate[3], "activate", dialog_simulator_mass, 0);
  g_signal_connect
    (dlg->item_simulate[5], "activate", dialog_save_solution_new, 0);
  g_signal_connect
    (dlg->item_simulate[6], "activate", dialog_save_graphical_new, 0);
  g_signal_connect_swapped (dlg->item_graphic[0], "activate",
                            (void (*)) dialog_graphical_options_new,
                            dlg->window);
  g_signal_connect_swapped (dlg->item_graphic[2], "activate",
                            (void *) dialog_simulator_animate, dlg);
  g_signal_connect (dlg->item_graphic[3], "activate", dialog_simulator_stop, 0);
  g_signal_connect_swapped
    (dlg->item_help[0], "activate", dialog_simulator_help, dlg);
  g_signal_connect_swapped
    (dlg->item_help[1], "activate", dialog_simulator_about, dlg);

  g_signal_connect (dlg->button[0], "clicked", (void (*)) exit, 0);
  g_signal_connect (dlg->button[2], "clicked", dialog_simulator_new_system, 0);
  g_signal_connect_swapped (dlg->button[3], "clicked",
                            (void (*)) dialog_open_system_new,
                            dialog_open_system);
  g_signal_connect (dlg->button[4], "clicked", dialog_simulator_edit, 0);
  g_signal_connect_swapped
    (dlg->button[5], "clicked", (void (*)) system_save_xml, sys);
  g_signal_connect (dlg->button[6], "clicked", dialog_simulator_save_as, 0);
  g_signal_connect_swapped
    (dlg->button[8], "clicked", (void (*)) dialog_simulator_start, dlg);
  g_signal_connect (dlg->button[9], "clicked", dialog_simulator_stop, 0);
  g_signal_connect (dlg->button[10], "clicked", dialog_simulator_mass, 0);
  g_signal_connect (dlg->button[11], "clicked", dialog_save_solution_new, 0);
  g_signal_connect (dlg->button[12], "clicked", dialog_save_graphical_new, 0);
  g_signal_connect_swapped (dlg->button[14], "clicked",
                            (void (*)) dialog_graphical_options_new,
                            dlg->window);
  g_signal_connect_swapped (dlg->button[15], "clicked",
                            (void *) dialog_simulator_animate, dlg);
  g_signal_connect (dlg->button[16], "clicked", dialog_simulator_stop, 0);
  g_signal_connect_swapped
    (dlg->button[18], "clicked", (void (*)) dialog_simulator_help, dlg);
  g_signal_connect_swapped
    (dlg->button[19], "clicked", (void (*)) dialog_simulator_about, dlg);

  dialog_simulator_actualize (dlg);

  window_parent = dlg->window;

  return dlg;
}
Пример #3
0
void
dialog_graphical_options_new (GtkWindow * parent)
{
  int i;
  DialogGraphicalOptions dlg;

  char *string_animation[3]
    = { gettext ("_No animation"), gettext ("_Fast"), gettext ("_Detailed") };
  char *string_options[sys->nt + 8];
  char *string_channels[sys->n + 1];

  for (i = 0; i <= sys->n; ++i)
    string_channels[i] = sys->channel[i].name;

  string_graphical_options (string_options, sys);

  dlg.button_adjust = (GtkCheckButton *) gtk_check_button_new_with_mnemonic
    (gettext ("_Manual adjust"));
  g_signal_connect_swapped (dlg.button_adjust, "clicked",
                            (void (*)()) dialog_graphical_options_actualize,
                            &dlg);

  dlg.button_grid = (GtkCheckButton *) gtk_check_button_new_with_mnemonic
    (gettext ("_Show grid"));

  dlg.label_profile_xmax = (GtkLabel *) gtk_label_new (gettext ("Maximum"));
  dlg.entry_profile_xmax = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.label_profile_xmin = (GtkLabel *) gtk_label_new (gettext ("Minimum"));
  dlg.entry_profile_xmin = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.table_profile_x = (GtkGrid *) gtk_grid_new ();
  gtk_grid_attach
    (dlg.table_profile_x, GTK_WIDGET (dlg.label_profile_xmax), 0, 0, 1, 1);
  gtk_grid_attach
    (dlg.table_profile_x, GTK_WIDGET (dlg.entry_profile_xmax), 1, 0, 1, 1);
  gtk_grid_attach
    (dlg.table_profile_x, GTK_WIDGET (dlg.label_profile_xmin), 0, 1, 1, 1);
  gtk_grid_attach
    (dlg.table_profile_x, GTK_WIDGET (dlg.entry_profile_xmin), 1, 1, 1, 1);

  dlg.frame_profile_x = (GtkFrame *) gtk_frame_new (gettext ("Position"));
  gtk_container_add
    (GTK_CONTAINER (dlg.frame_profile_x), GTK_WIDGET (dlg.table_profile_x));

  dlg.combo_profile_y =
    jbw_combo_box_new_with_strings (string_options, 8 + sys->nt);

  dlg.label_profile_ymax = (GtkLabel *) gtk_label_new (gettext ("Maximum"));
  dlg.entry_profile_ymax = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.label_profile_ymin = (GtkLabel *) gtk_label_new (gettext ("Minimum"));
  dlg.entry_profile_ymin = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.table_profile_y = (GtkGrid *) gtk_grid_new ();
  gtk_grid_attach
    (dlg.table_profile_y, GTK_WIDGET (dlg.combo_profile_y), 0, 0, 2, 1);
  gtk_grid_attach
    (dlg.table_profile_y, GTK_WIDGET (dlg.label_profile_ymax), 0, 1, 1, 1);
  gtk_grid_attach
    (dlg.table_profile_y, GTK_WIDGET (dlg.entry_profile_ymax), 1, 1, 1, 1);
  gtk_grid_attach
    (dlg.table_profile_y, GTK_WIDGET (dlg.label_profile_ymin), 0, 2, 1, 1);
  gtk_grid_attach
    (dlg.table_profile_y, GTK_WIDGET (dlg.entry_profile_ymin), 1, 2, 1, 1);

  dlg.frame_profile_y = (GtkFrame *) gtk_frame_new (gettext ("Parameter 1"));
  gtk_container_add
    (GTK_CONTAINER (dlg.frame_profile_y), GTK_WIDGET (dlg.table_profile_y));

  dlg.combo_profile_z =
    jbw_combo_box_new_with_strings (string_options, 8 + sys->nt);

  dlg.label_profile_zmax = (GtkLabel *) gtk_label_new (gettext ("Maximum"));
  dlg.entry_profile_zmax = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.label_profile_zmin = (GtkLabel *) gtk_label_new (gettext ("Minimum"));
  dlg.entry_profile_zmin = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.table_profile_z = (GtkGrid *) gtk_grid_new ();
  gtk_grid_attach
    (dlg.table_profile_z, GTK_WIDGET (dlg.combo_profile_z), 0, 0, 2, 1);
  gtk_grid_attach
    (dlg.table_profile_z, GTK_WIDGET (dlg.label_profile_zmax), 0, 1, 1, 1);
  gtk_grid_attach
    (dlg.table_profile_z, GTK_WIDGET (dlg.entry_profile_zmax), 1, 1, 1, 1);
  gtk_grid_attach
    (dlg.table_profile_z, GTK_WIDGET (dlg.label_profile_zmin), 0, 2, 1, 1);
  gtk_grid_attach
    (dlg.table_profile_z, GTK_WIDGET (dlg.entry_profile_zmin), 1, 2, 1, 1);

  dlg.frame_profile_z = (GtkFrame *) gtk_frame_new (gettext ("Parameter 2"));
  gtk_container_add
    (GTK_CONTAINER (dlg.frame_profile_z), GTK_WIDGET (dlg.table_profile_z));

  dlg.table_profile = (GtkGrid *) gtk_grid_new ();
  gtk_grid_attach
    (dlg.table_profile, GTK_WIDGET (dlg.frame_profile_x), 0, 1, 1, 1);
  gtk_grid_attach
    (dlg.table_profile, GTK_WIDGET (dlg.frame_profile_y), 0, 2, 1, 1);
  gtk_grid_attach
    (dlg.table_profile, GTK_WIDGET (dlg.frame_profile_z), 0, 3, 1, 1);

  if (simulated)
    {
      char *string_profile[nstep];
      for (i = 0; i < nstep; ++i)
        {
          string_profile[i] = (char *) g_malloc (32 * sizeof (char));
          snprintf (string_profile[i], 32, FGL, (JBDOUBLE) fmin (i * ti, tf));
        }
      dlg.combo_profile = jbw_combo_box_new_with_strings (string_profile, i);
      dlg.label_profile_time = (GtkLabel *) gtk_label_new (gettext ("Time"));
      dlg.box_profile = (GtkGrid *) gtk_grid_new ();
      gtk_grid_attach (dlg.box_profile, GTK_WIDGET (dlg.label_profile_time),
                       0, 0, 1, 1);
      gtk_grid_attach (dlg.box_profile, GTK_WIDGET (dlg.combo_profile),
                       1, 0, 1, 1);
      gtk_grid_attach (dlg.table_profile, GTK_WIDGET (dlg.box_profile),
                       0, 0, 1, 1);
    }

  dlg.label_evolution_xmax = (GtkLabel *) gtk_label_new (gettext ("Maximum"));
  dlg.entry_evolution_xmax = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.label_evolution_xmin = (GtkLabel *) gtk_label_new (gettext ("Minimum"));
  dlg.entry_evolution_xmin = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.table_evolution_x = (GtkGrid *) gtk_grid_new ();
  gtk_grid_attach (dlg.table_evolution_x, GTK_WIDGET (dlg.label_evolution_xmax),
                   0, 0, 1, 1);
  gtk_grid_attach (dlg.table_evolution_x, GTK_WIDGET (dlg.entry_evolution_xmax),
                   1, 0, 2, 1);
  gtk_grid_attach (dlg.table_evolution_x, GTK_WIDGET (dlg.label_evolution_xmin),
                   0, 1, 1, 1);
  gtk_grid_attach (dlg.table_evolution_x, GTK_WIDGET (dlg.entry_evolution_xmin),
                   1, 1, 2, 1);

  dlg.frame_evolution_x = (GtkFrame *) gtk_frame_new (gettext ("Time"));
  gtk_container_add (GTK_CONTAINER (dlg.frame_evolution_x),
                     GTK_WIDGET (dlg.table_evolution_x));

  dlg.combo_evolution_y =
    jbw_combo_box_new_with_strings (string_options, 8 + sys->nt);

  dlg.label_evolution_ymax = (GtkLabel *) gtk_label_new (gettext ("Maximum"));
  dlg.entry_evolution_ymax = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.label_evolution_ymin = (GtkLabel *) gtk_label_new (gettext ("Minimum"));
  dlg.entry_evolution_ymin = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.table_evolution_y = (GtkGrid *) gtk_grid_new ();
  gtk_grid_attach (dlg.table_evolution_y, GTK_WIDGET (dlg.combo_evolution_y),
                   0, 0, 2, 1);
  gtk_grid_attach (dlg.table_evolution_y, GTK_WIDGET (dlg.label_evolution_ymax),
                   0, 1, 1, 1);
  gtk_grid_attach (dlg.table_evolution_y, GTK_WIDGET (dlg.entry_evolution_ymax),
                   1, 1, 1, 1);
  gtk_grid_attach (dlg.table_evolution_y, GTK_WIDGET (dlg.label_evolution_ymin),
                   0, 2, 1, 1);
  gtk_grid_attach (dlg.table_evolution_y, GTK_WIDGET (dlg.entry_evolution_ymin),
                   1, 2, 1, 1);

  dlg.frame_evolution_y = (GtkFrame *) gtk_frame_new (gettext ("Parameter 1"));
  gtk_container_add (GTK_CONTAINER (dlg.frame_evolution_y),
                     GTK_WIDGET (dlg.table_evolution_y));

  dlg.combo_evolution_z =
    jbw_combo_box_new_with_strings (string_options, 8 + sys->nt);

  dlg.label_evolution_zmax = (GtkLabel *) gtk_label_new (gettext ("Maximum"));
  dlg.entry_evolution_zmax = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.label_evolution_zmin = (GtkLabel *) gtk_label_new (gettext ("Minimum"));
  dlg.entry_evolution_zmin = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.table_evolution_z = (GtkGrid *) gtk_grid_new ();
  gtk_grid_attach (dlg.table_evolution_z, GTK_WIDGET (dlg.combo_evolution_z),
                   0, 0, 2, 1);
  gtk_grid_attach (dlg.table_evolution_z, GTK_WIDGET (dlg.label_evolution_zmax),
                   0, 1, 1, 1);
  gtk_grid_attach (dlg.table_evolution_z, GTK_WIDGET (dlg.entry_evolution_zmax),
                   1, 1, 1, 1);
  gtk_grid_attach (dlg.table_evolution_z, GTK_WIDGET (dlg.label_evolution_zmin),
                   0, 2, 1, 1);
  gtk_grid_attach (dlg.table_evolution_z, GTK_WIDGET (dlg.entry_evolution_zmin),
                   1, 2, 1, 1);

  dlg.frame_evolution_z = (GtkFrame *) gtk_frame_new (gettext ("Parameter 2"));
  gtk_container_add (GTK_CONTAINER (dlg.frame_evolution_z),
                     GTK_WIDGET (dlg.table_evolution_z));

  dlg.label_evolution_section =
    (GtkLabel *) gtk_label_new (gettext ("Transient section"));

  dlg.combo_evolution_section = (GtkComboBoxText *) gtk_combo_box_text_new ();
  dlg.combo_section = (GtkComboBoxText *) gtk_combo_box_text_new ();
  dialog_graphical_options_sections (&dlg);

  dlg.table_evolution = (GtkGrid *) gtk_grid_new ();
  gtk_grid_attach (dlg.table_evolution,
                   GTK_WIDGET (dlg.label_evolution_section), 0, 0, 1, 1);
  gtk_grid_attach (dlg.table_evolution,
                   GTK_WIDGET (dlg.combo_evolution_section), 0, 1, 1, 1);
  gtk_grid_attach (dlg.table_evolution,
                   GTK_WIDGET (dlg.frame_evolution_x), 0, 2, 1, 1);
  gtk_grid_attach (dlg.table_evolution,
                   GTK_WIDGET (dlg.frame_evolution_y), 0, 3, 1, 1);
  gtk_grid_attach (dlg.table_evolution,
                   GTK_WIDGET (dlg.frame_evolution_z), 0, 4, 1, 1);

  dlg.label_section_xmax = (GtkLabel *) gtk_label_new (gettext ("Maximum"));
  dlg.entry_section_xmax = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.label_section_xmin = (GtkLabel *) gtk_label_new (gettext ("Minimum"));
  dlg.entry_section_xmin = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.table_section_x = (GtkGrid *) gtk_grid_new ();
  gtk_grid_attach
    (dlg.table_section_x, GTK_WIDGET (dlg.label_section_xmax), 0, 0, 1, 1);
  gtk_grid_attach
    (dlg.table_section_x, GTK_WIDGET (dlg.entry_section_xmax), 1, 0, 1, 1);
  gtk_grid_attach
    (dlg.table_section_x, GTK_WIDGET (dlg.label_section_xmin), 0, 1, 1, 1);
  gtk_grid_attach
    (dlg.table_section_x, GTK_WIDGET (dlg.entry_section_xmin), 1, 1, 1, 1);

  dlg.frame_section_x = (GtkFrame *) gtk_frame_new (gettext ("Position"));
  gtk_container_add (GTK_CONTAINER (dlg.frame_section_x),
                     GTK_WIDGET (dlg.table_section_x));

  dlg.label_section_ymax = (GtkLabel *) gtk_label_new (gettext ("Maximum"));
  dlg.entry_section_ymax = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.label_section_ymin = (GtkLabel *) gtk_label_new (gettext ("Minimum"));
  dlg.entry_section_ymin = (JBWFloatEntry *) jbw_float_entry_new ();

  dlg.table_section_y = (GtkGrid *) gtk_grid_new ();
  gtk_grid_attach
    (dlg.table_section_y, GTK_WIDGET (dlg.label_section_ymax), 0, 0, 1, 1);
  gtk_grid_attach
    (dlg.table_section_y, GTK_WIDGET (dlg.entry_section_ymax), 1, 0, 1, 1);
  gtk_grid_attach
    (dlg.table_section_y, GTK_WIDGET (dlg.label_section_ymin), 0, 1, 1, 1);
  gtk_grid_attach
    (dlg.table_section_y, GTK_WIDGET (dlg.entry_section_ymin), 1, 1, 1, 1);

  dlg.frame_section_y = (GtkFrame *) gtk_frame_new (gettext ("Level"));
  gtk_container_add
    (GTK_CONTAINER (dlg.frame_section_y), GTK_WIDGET (dlg.table_section_y));


  dlg.label_section_section =
    (GtkLabel *) gtk_label_new (gettext ("Transient section"));

  dlg.table_section = (GtkGrid *) gtk_grid_new ();
  gtk_grid_attach
    (dlg.table_section, GTK_WIDGET (dlg.label_section_section), 0, 0, 1, 1);
  gtk_grid_attach
    (dlg.table_section, GTK_WIDGET (dlg.combo_section), 0, 1, 1, 1);
  gtk_grid_attach
    (dlg.table_section, GTK_WIDGET (dlg.frame_section_x), 0, 2, 1, 1);
  gtk_grid_attach
    (dlg.table_section, GTK_WIDGET (dlg.frame_section_y), 0, 3, 1, 1);

  dlg.label_profile
    = (GtkLabel *) gtk_label_new (gettext ("Longitudinal profile"));
  dlg.label_evolution = (GtkLabel *) gtk_label_new (gettext ("Time evolution"));
  dlg.label_section =
    (GtkLabel *) gtk_label_new (gettext ("Transient section"));

  dlg.notebook = (GtkNotebook *) gtk_notebook_new ();
  gtk_notebook_append_page (dlg.notebook,
                            GTK_WIDGET (dlg.table_profile),
                            GTK_WIDGET (dlg.label_profile));
  gtk_notebook_append_page (dlg.notebook, GTK_WIDGET (dlg.table_evolution),
                            GTK_WIDGET (dlg.label_evolution));
  gtk_notebook_append_page (dlg.notebook, GTK_WIDGET (dlg.table_section),
                            GTK_WIDGET (dlg.label_section));

  dlg.array_animation[0] = 0;
  dlg.box_animation = (GtkGrid *) gtk_grid_new ();
  for (i = 0; i < 3; ++i)
    {
      dlg.array_animation[i] = (GtkRadioButton *)
        gtk_radio_button_new_with_mnemonic_from_widget
        (dlg.array_animation[0], string_animation[i]);
      gtk_grid_attach (dlg.box_animation, GTK_WIDGET (dlg.array_animation[i]),
                       0, i, 1, 1);
    }

  dlg.frame_animation = (GtkFrame *) gtk_frame_new (gettext ("Animation"));
  gtk_container_add (GTK_CONTAINER (dlg.frame_animation),
                     GTK_WIDGET (dlg.box_animation));

  dlg.combo_channel =
    jbw_combo_box_new_with_strings (string_channels, sys->n + 1);

  dlg.vbox = (GtkGrid *) gtk_grid_new ();
  gtk_grid_attach (dlg.vbox, GTK_WIDGET (dlg.combo_channel), 0, 0, 1, 1);
  gtk_grid_attach (dlg.vbox, GTK_WIDGET (dlg.frame_animation), 0, 1, 1, 1);
  gtk_grid_attach (dlg.vbox, GTK_WIDGET (dlg.button_adjust), 0, 2, 1, 1);
  gtk_grid_attach (dlg.vbox, GTK_WIDGET (dlg.button_grid), 0, 3, 1, 1);

  dlg.box = (GtkGrid *) gtk_grid_new ();
  gtk_grid_attach (dlg.box, GTK_WIDGET (dlg.notebook), 0, 0, 1, 1);
  gtk_grid_attach (dlg.box, GTK_WIDGET (dlg.vbox), 1, 0, 1, 1);

  dlg.window =
    (GtkDialog *) gtk_dialog_new_with_buttons (gettext ("Graphical options"),
                                               parent, GTK_DIALOG_MODAL,
                                               gettext ("_OK"), GTK_RESPONSE_OK,
                                               gettext ("_Cancel"),
                                               GTK_RESPONSE_CANCEL, NULL);
  gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (dlg.window)),
                     GTK_WIDGET (dlg.box));
  gtk_widget_show_all (GTK_WIDGET (dlg.box));

  jbw_float_entry_set_value (dlg.entry_profile_xmax, profile_xmax);
  jbw_float_entry_set_value (dlg.entry_profile_xmin, profile_xmin);
  jbw_float_entry_set_value (dlg.entry_profile_ymax, profile_ymax);
  jbw_float_entry_set_value (dlg.entry_profile_ymin, profile_ymin);
  jbw_float_entry_set_value (dlg.entry_profile_zmax, profile_zmax);
  jbw_float_entry_set_value (dlg.entry_profile_zmin, profile_zmin);
  if (simulated)
    gtk_combo_box_set_active (GTK_COMBO_BOX (dlg.combo_profile), istep);
  gtk_combo_box_set_active
    (GTK_COMBO_BOX (dlg.combo_profile_y), profile_parameter1);
  gtk_combo_box_set_active
    (GTK_COMBO_BOX (dlg.combo_profile_z), profile_parameter2);

  jbw_float_entry_set_value (dlg.entry_evolution_xmax, evolution_xmax);
  jbw_float_entry_set_value (dlg.entry_evolution_xmin, evolution_xmin);
  jbw_float_entry_set_value (dlg.entry_evolution_ymax, evolution_ymax);
  jbw_float_entry_set_value (dlg.entry_evolution_ymin, evolution_ymin);
  jbw_float_entry_set_value (dlg.entry_evolution_zmax, evolution_zmax);
  jbw_float_entry_set_value (dlg.entry_evolution_zmin, evolution_zmin);
  gtk_combo_box_set_active
    (GTK_COMBO_BOX (dlg.combo_evolution_y), evolution_parameter1);
  gtk_combo_box_set_active
    (GTK_COMBO_BOX (dlg.combo_evolution_z), evolution_parameter2);
  gtk_combo_box_set_active
    (GTK_COMBO_BOX (dlg.combo_evolution_section), evolution_section);

  gtk_toggle_button_set_active
    ((GtkToggleButton *) dlg.button_adjust, draw_adjust);

  gtk_toggle_button_set_active ((GtkToggleButton *) dlg.button_grid, draw_grid);

  jbw_float_entry_set_value (dlg.entry_section_xmax, section_xmax);
  jbw_float_entry_set_value (dlg.entry_section_xmin, section_xmin);
  jbw_float_entry_set_value (dlg.entry_section_ymax, section_ymax);
  jbw_float_entry_set_value (dlg.entry_section_ymin, section_ymin);
  gtk_combo_box_set_active (GTK_COMBO_BOX (dlg.combo_section), section);

  jbw_array_radio_buttons_set_active (dlg.array_animation, type_animation, 1);
  gtk_notebook_set_current_page (dlg.notebook, type_draw);

  gtk_combo_box_set_active (GTK_COMBO_BOX (dlg.combo_channel), channel);

  dialog_graphical_options_actualize (&dlg);

  g_signal_connect_swapped (dlg.combo_channel, "changed",
                            (void (*)) dialog_graphical_options_channel, &dlg);

  if (gtk_dialog_run (dlg.window) == GTK_RESPONSE_OK)
    {
      if (simulated)
        {
          istep = gtk_combo_box_get_active (GTK_COMBO_BOX (dlg.combo_profile));
          t = fmin (t0 + istep * ti, tf);
          dialog_simulator_actualize_bar (dialog_simulator);
        }
      channel = gtk_combo_box_get_active (GTK_COMBO_BOX (dlg.combo_channel));
      draw_adjust =
        gtk_toggle_button_get_active ((GtkToggleButton *) dlg.button_adjust);
      draw_grid =
        gtk_toggle_button_get_active ((GtkToggleButton *) dlg.button_grid);
      profile_parameter1 =
        gtk_combo_box_get_active (GTK_COMBO_BOX (dlg.combo_profile_y));
      profile_parameter2 =
        gtk_combo_box_get_active (GTK_COMBO_BOX (dlg.combo_profile_z));
      profile_xmin = jbw_float_entry_get_value (dlg.entry_profile_xmin);
      profile_xmax = jbw_float_entry_get_value (dlg.entry_profile_xmax);
      profile_ymin = jbw_float_entry_get_value (dlg.entry_profile_ymin);
      profile_ymax = jbw_float_entry_get_value (dlg.entry_profile_ymax);
      profile_zmin = jbw_float_entry_get_value (dlg.entry_profile_zmin);
      profile_zmax = jbw_float_entry_get_value (dlg.entry_profile_zmax);
      evolution_parameter1 =
        gtk_combo_box_get_active (GTK_COMBO_BOX (dlg.combo_evolution_y));
      evolution_parameter2 =
        gtk_combo_box_get_active (GTK_COMBO_BOX (dlg.combo_evolution_z));
      evolution_xmin = jbw_float_entry_get_value (dlg.entry_evolution_xmin);
      evolution_xmax = jbw_float_entry_get_value (dlg.entry_evolution_xmax);
      evolution_ymin = jbw_float_entry_get_value (dlg.entry_evolution_ymin);
      evolution_ymax = jbw_float_entry_get_value (dlg.entry_evolution_ymax);
      evolution_zmin = jbw_float_entry_get_value (dlg.entry_evolution_zmin);
      evolution_zmax = jbw_float_entry_get_value (dlg.entry_evolution_zmax);
      evolution_section = gtk_combo_box_get_active
        (GTK_COMBO_BOX (dlg.combo_evolution_section));
      section_xmin = jbw_float_entry_get_value (dlg.entry_section_xmin);
      section_xmax = jbw_float_entry_get_value (dlg.entry_section_xmax);
      section_ymin = jbw_float_entry_get_value (dlg.entry_section_ymin);
      section_ymax = jbw_float_entry_get_value (dlg.entry_section_ymax);
      section = gtk_combo_box_get_active (GTK_COMBO_BOX (dlg.combo_section));
      type_draw = gtk_notebook_get_current_page (dlg.notebook);
      type_animation = jbw_array_radio_buttons_get_active (dlg.array_animation);
      dialog_simulator_actualize (dialog_simulator);
    }
  gtk_widget_destroy (GTK_WIDGET (dlg.window));
  draw ();
}