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

void range_dialog_create ( Plot plot,
gint  action,
GtkItem *  range_set_button 
)

Create a dialog which prompts the user to enter (x,y) range values.

Parameters:
plot The Plot for which the ranges are to be set.
action The action initiating the call (unused).
range_set_button The button initiating the call.

Definition at line 795 of file axis.c.

References axis_set_from_dialog(), axis_type_set_toggle(), range_entry_value_set(), _Plot::x_axis, and _Plot::y_axis.

{
  GtkWidget* dialog;
  GtkWidget* range_table;
  GtkWidget* label_xmin;
  GtkWidget* label_xmax;
  GtkWidget* label_ymin;
  GtkWidget* label_ymax;
  GtkWidget* okay_button;
  GtkWidget* apply_button;
  GtkWidget* cancel_button;
  GtkWidget* label_xtype;
  GtkWidget* radio_xtype_hbox;
  GSList* radio_group_xtype;
  GtkWidget* label_ytype;
  GtkWidget* radio_ytype_hbox;
  GSList* radio_group_ytype;

  UNUSED(action);
  UNUSED(range_set_button);
  dialog = gtk_dialog_new();
  gtk_window_set_title(GTK_WINDOW(dialog), RANGE_DIALOG_TITLE);
  gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, TRUE);

  range_table = gtk_table_new(4, 2, TRUE);

  /*
   * Entry labels.
   */
  label_xmin = gtk_label_new(XMIN_LABEL);
  gtk_widget_show(label_xmin);
  gtk_table_attach_defaults(GTK_TABLE(range_table), label_xmin, 0, 1, 0, 1);

  entry_xmin = gtk_entry_new();
  gtk_entry_set_max_length(GTK_ENTRY(entry_xmin), RANGE_VAL_SIZE);
  gtk_signal_connect(GTK_OBJECT(entry_xmin), "activate",
                     GTK_SIGNAL_FUNC(axis_set_from_dialog), plot);
  gtk_widget_show(entry_xmin);
  gtk_table_attach_defaults(GTK_TABLE(range_table), entry_xmin, 1, 2, 0, 1);
  gtk_widget_set_usize(entry_xmin, RANGE_VAL_SIZE, -2);

  label_xmax = gtk_label_new(XMAX_LABEL);
  gtk_widget_show(label_xmax);
  gtk_table_attach_defaults(GTK_TABLE(range_table), label_xmax, 0, 1, 1, 2);

  entry_xmax = gtk_entry_new();
  gtk_entry_set_max_length(GTK_ENTRY(entry_xmax), RANGE_VAL_SIZE);
  gtk_signal_connect(GTK_OBJECT(entry_xmax), "activate",
                     GTK_SIGNAL_FUNC(axis_set_from_dialog), plot);
  gtk_widget_show(entry_xmax);
  gtk_table_attach_defaults(GTK_TABLE(range_table), entry_xmax, 1, 2, 1, 2);
  gtk_widget_set_usize(entry_xmax, RANGE_VAL_SIZE, -2);

  label_xtype = gtk_label_new(X_AXIS_TYPE_LABEL);
  gtk_widget_show(label_xtype);
  gtk_table_attach_defaults(GTK_TABLE(range_table), label_xtype, 0, 1, 2, 3);
  
  radio_xtype_hbox = gtk_hbox_new(TRUE, 2);
  radio_xtype_linear = gtk_radio_button_new_with_label
    (NULL, AXIS_LINEAR_TYPE_LABEL);
  radio_group_xtype = gtk_radio_button_group
    (GTK_RADIO_BUTTON(radio_xtype_linear));
  radio_xtype_log = gtk_radio_button_new_with_label
    (radio_group_xtype, AXIS_LOG_TYPE_LABEL);
  gtk_box_pack_start(GTK_BOX(radio_xtype_hbox), radio_xtype_linear,
                     TRUE, TRUE, 2);
  gtk_box_pack_start(GTK_BOX(radio_xtype_hbox), radio_xtype_log,
                     TRUE, TRUE, 2);
  gtk_widget_show(radio_xtype_hbox);
  gtk_table_attach_defaults(GTK_TABLE(range_table), radio_xtype_hbox,
                            1, 2, 2, 3);
  axis_type_set_toggle(plot->x_axis, GTK_TOGGLE_BUTTON(radio_xtype_linear),
                       GTK_TOGGLE_BUTTON(radio_xtype_log));

  label_ymin = gtk_label_new(YMIN_LABEL);
  gtk_widget_show(label_ymin);
  gtk_table_attach_defaults(GTK_TABLE(range_table), label_ymin, 0, 1, 3, 4);

  entry_ymin = gtk_entry_new();
  gtk_entry_set_max_length(GTK_ENTRY(entry_ymin), RANGE_VAL_SIZE);
  gtk_signal_connect(GTK_OBJECT(entry_ymin), "activate",
                     GTK_SIGNAL_FUNC(axis_set_from_dialog), plot);
  gtk_widget_show(entry_ymin);
  gtk_table_attach_defaults(GTK_TABLE(range_table), entry_ymin, 1, 2, 3, 4);
  gtk_widget_set_usize(entry_ymin, RANGE_VAL_SIZE, -2);

  label_ymax = gtk_label_new(YMAX_LABEL);
  gtk_widget_show(label_ymax);
  gtk_table_attach_defaults(GTK_TABLE(range_table), label_ymax, 0, 1, 4, 5);

  entry_ymax = gtk_entry_new();
  gtk_entry_set_max_length(GTK_ENTRY(entry_ymax), RANGE_VAL_SIZE);
  gtk_signal_connect(GTK_OBJECT(entry_ymax), "activate",
                     GTK_SIGNAL_FUNC(axis_set_from_dialog), plot);
  gtk_widget_show(entry_ymax);
  gtk_table_attach_defaults(GTK_TABLE(range_table), entry_ymax, 1, 2, 4, 5);
  gtk_widget_set_usize(entry_ymax, RANGE_VAL_SIZE, -2);

  gtk_widget_show(range_table);
  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), range_table, FALSE,
                     FALSE, 0);

  label_ytype = gtk_label_new(Y_AXIS_TYPE_LABEL);
  gtk_widget_show(label_ytype);
  gtk_table_attach_defaults(GTK_TABLE(range_table), label_ytype, 0, 1, 5, 6);
  
  radio_ytype_hbox = gtk_hbox_new(TRUE, 2);
  radio_ytype_linear = gtk_radio_button_new_with_label(NULL, 
                                                       AXIS_LINEAR_TYPE_LABEL);
  radio_group_ytype = gtk_radio_button_group
    (GTK_RADIO_BUTTON(radio_ytype_linear));
  radio_ytype_log = gtk_radio_button_new_with_label(radio_group_ytype,
                                                    AXIS_LOG_TYPE_LABEL);
  gtk_box_pack_start(GTK_BOX(radio_ytype_hbox), radio_ytype_linear,
                     TRUE, TRUE, 2);
  gtk_box_pack_start(GTK_BOX(radio_ytype_hbox), radio_ytype_log,
                     TRUE, TRUE, 2);
  gtk_widget_show(radio_ytype_hbox);
  gtk_table_attach_defaults(GTK_TABLE(range_table), radio_ytype_hbox,
                            1, 2, 5, 6);
  axis_type_set_toggle(plot->y_axis, GTK_TOGGLE_BUTTON(radio_ytype_linear),
                       GTK_TOGGLE_BUTTON(radio_ytype_log));

  range_entry_value_set(plot);

  /*
   * Okay button.
   */
  okay_button = gtk_button_new_with_label(OKAY_BUTTON_LABEL);
  gtk_signal_connect(GTK_OBJECT(okay_button),
                     "clicked", GTK_SIGNAL_FUNC(axis_set_from_dialog), plot);
  gtk_signal_connect_object (GTK_OBJECT (okay_button), "clicked",
                             GTK_SIGNAL_FUNC (gtk_widget_destroy),
                             GTK_OBJECT(dialog));
  gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->action_area),
                     okay_button);
  gtk_widget_show(okay_button);

  /*
   * Apply button.
   */
  apply_button = gtk_button_new_with_label(APPLY_BUTTON_LABEL);
  gtk_signal_connect(GTK_OBJECT(apply_button),
                     "clicked", GTK_SIGNAL_FUNC(axis_set_from_dialog), plot);
  gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->action_area),
                     apply_button);
  gtk_widget_show(apply_button);

  /*
   * Cancel button.
   */
  cancel_button = gtk_button_new_with_label(CANCEL_BUTTON_LABEL);
  gtk_signal_connect_object (GTK_OBJECT (cancel_button), "clicked",
                             GTK_SIGNAL_FUNC (gtk_widget_destroy),
                             GTK_OBJECT(dialog));
  gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->action_area),
                     cancel_button);
  gtk_widget_show(cancel_button);

  gtk_widget_show_all (dialog);
}


Generated by  Doxygen 1.6.0   Back to index