Beispiel #1
0
/*! \private
 *  \brief Create section with snap and grid settings
 *
 *  \param [in] widget
 *  \return The snap section widget
 */
static GtkWidget*
create_snap_section (GschemOptionsWidget *widget)
{
  GtkWidget *label[3];
  GtkWidget *table;
  GtkWidget *editor[3];

  label[0] = gschem_dialog_misc_create_property_label (_("Grid Mode:"));
  label[1] = gschem_dialog_misc_create_property_label (_("Snap Mode:"));
  label[2] = gschem_dialog_misc_create_property_label (_("Snap Size:"));

  editor[0] = create_grid_mode_widget (widget);
  editor[1] = create_snap_mode_widget (widget);
  editor[2] = widget->snap_size = gtk_spin_button_new_with_range (MINIMUM_SNAP_SIZE,
                                                                  MAXIMUM_SNAP_SIZE,
                                                                  5);

  table = gschem_dialog_misc_create_property_table (label, editor, 3);

  // gtk_editable_select_region (GTK_EDITABLE(spin_size), 0, -1);

  g_signal_connect_swapped (G_OBJECT (widget->snap_size),
                            "value-changed",
                            G_CALLBACK (update_snap_size_model),
                            widget);

  return gschem_dialog_misc_create_section_widget (_("<b>Snap Options</b>"), table);
}
Beispiel #2
0
/*! \private
 *  \brief Create section with net tool settings
 *
 *  \param [in] widget
 *  \return The net section widget
 */
static GtkWidget*
create_net_section (GschemOptionsWidget *widget)
{
  GtkWidget *label[2];
  GtkWidget *table;
  GtkWidget *editor[2];

  /* These widgets are shown in the same order as the options menu */

  label[0] = gschem_dialog_misc_create_property_label (_("Net Rubber Band Mode:"));
  label[1] = gschem_dialog_misc_create_property_label (_("Magnetic Net Mode:"));

  /*! \todo These should become a GtkSwitch when updating to GTK 3.0 */

  editor[0] = widget->net_rubber_band_widget = gtk_check_button_new_with_label (_("Enabled"));
  editor[1] = widget->magnetic_net_widget = gtk_check_button_new_with_label (_("Enabled"));

  table = gschem_dialog_misc_create_property_table (label, editor, 2);

  g_signal_connect_swapped (G_OBJECT (widget->magnetic_net_widget),
                            "toggled",
                            G_CALLBACK (update_magnetic_net_mode_model),
                            widget);

  g_signal_connect_swapped (G_OBJECT (widget->net_rubber_band_widget),
                            "toggled",
                            G_CALLBACK (update_net_rubber_band_mode_model),
                            widget);

  return gschem_dialog_misc_create_section_widget (_("<b>Net Options</b>"), table);
}
Beispiel #3
0
/*! \brief Creates the arc angle dialog
 *  \par Function Description
 *  This function creates the arc angle dialog. Depending on the
 *  \a arc_object the entries are filled with the arc OBJECT properties
 *  or with some standard values.
 *
 *  \param [in] w_current   The GschemToplevel object
 *  \param [in] arc_object  an arc OBJECT if used to modify an arc
 *                          or NULL to create a new arc.
 */
void arc_angle_dialog (GschemToplevel *w_current, OBJECT *arc_object)
{
  GtkWidget *label[3];
  GtkWidget *vbox;
  GtkWidget *alignment, *table;
  GtkWidget *widget[3];

  if (!w_current->aawindow) {
    w_current->aawindow = gschem_dialog_new_with_buttons(_("Arc Params"),
                                                         GTK_WINDOW(w_current->main_window),
                                                         GTK_DIALOG_MODAL,
                                                         "arc-angle", w_current,
                                                         GTK_STOCK_CANCEL,
                                                         GTK_RESPONSE_REJECT,
                                                         GTK_STOCK_OK,
                                                         GTK_RESPONSE_ACCEPT,
                                                         NULL);

  /* Set the alternative button order (ok, cancel, help) for other systems */
    gtk_dialog_set_alternative_button_order(GTK_DIALOG(w_current->aawindow),
                                            GTK_RESPONSE_ACCEPT,
                                            GTK_RESPONSE_REJECT,
                                            -1);

    gtk_window_set_position (GTK_WINDOW (w_current->aawindow), GTK_WIN_POS_MOUSE);

    g_signal_connect (G_OBJECT (w_current->aawindow), "response",
                      G_CALLBACK (arc_angle_dialog_response),
                      w_current);

    gtk_dialog_set_default_response(GTK_DIALOG(w_current->aawindow),
                                    GTK_RESPONSE_ACCEPT);

    gtk_container_set_border_width (GTK_CONTAINER (w_current->aawindow),
                                    DIALOG_BORDER_SPACING);
    vbox = GTK_DIALOG(w_current->aawindow)->vbox;
    gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);


    alignment = gtk_alignment_new(0,0,1,1);
    gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0,
                              0 /*DIALOG_INDENTATION */, 0);
    gtk_box_pack_start(GTK_BOX(vbox), alignment, FALSE, FALSE, 0);

    label[0] = gschem_dialog_misc_create_property_label (_("Arc Radius:"));
    label[1] = gschem_dialog_misc_create_property_label (_("Start Angle:"));
    label[2] = gschem_dialog_misc_create_property_label (_("Degrees of Sweep:"));

    widget[0] = gtk_spin_button_new_with_range (1, 100000, 100);
    gtk_entry_set_activates_default (GTK_ENTRY(widget[0]), TRUE);

    widget[1] = gtk_spin_button_new_with_range (-360,360,1);
    gtk_entry_set_activates_default (GTK_ENTRY(widget[1]), TRUE);

    widget[2] = gtk_spin_button_new_with_range (-360,360,1);
    gtk_entry_set_activates_default(GTK_ENTRY(widget[2]), TRUE);

	table = gschem_dialog_misc_create_property_table (label, widget, 3);
    gtk_container_add (GTK_CONTAINER(alignment), table);

    GLADE_HOOKUP_OBJECT(w_current->aawindow, widget[0], "radius");
    GLADE_HOOKUP_OBJECT(w_current->aawindow, widget[1],"spin_start");
    GLADE_HOOKUP_OBJECT(w_current->aawindow, widget[2],"spin_sweep");
    g_object_set_data(G_OBJECT(w_current->aawindow), "arc_object", arc_object);
    gtk_widget_show_all (w_current->aawindow);
  }

  else {  /* dialog already created */
    gtk_window_present (GTK_WINDOW(w_current->aawindow));
    widget[0] = g_object_get_data(G_OBJECT(w_current->aawindow),"radius");
    widget[1] = g_object_get_data(G_OBJECT(w_current->aawindow),"spin_start");
    widget[2] = g_object_get_data(G_OBJECT(w_current->aawindow),"spin_sweep");
  }

  if (arc_object == NULL) {
    gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget[0]), w_current->distance);
    gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget[1]),0);
    gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget[2]), 90);
  } else {
    gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget[0]),
			      arc_object->arc->radius);
    gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget[1]),
			      arc_object->arc->start_angle);
    gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget[2]),
			      arc_object->arc->sweep_angle);
  }

  gtk_widget_grab_focus(widget[0]);
}
/*! \brief Create the slot entry dialog
 *  \par Function Description
 *  This function creates the slot edit dialog.
 */
void slot_edit_dialog (GschemToplevel *w_current, const char *count, const char *string)
{
  GtkWidget *label[2];
  GtkWidget *table;
  GtkWidget *vbox;
  GtkWidget *widget[2];

  if (!w_current->sewindow) {
    w_current->sewindow = gschem_dialog_new_with_buttons(_("Edit slot number"),
                                                         GTK_WINDOW(w_current->main_window),
                                                         GTK_DIALOG_MODAL,
                                                         "slot-edit", w_current,
                                                         GTK_STOCK_CANCEL,
                                                         GTK_RESPONSE_REJECT,
                                                         GTK_STOCK_OK,
                                                         GTK_RESPONSE_ACCEPT,
                                                         NULL);

  /* Set the alternative button order (ok, cancel, help) for other systems */
    gtk_dialog_set_alternative_button_order(GTK_DIALOG(w_current->sewindow),
                                            GTK_RESPONSE_ACCEPT,
                                            GTK_RESPONSE_REJECT,
                                            -1);

    gtk_window_set_position (GTK_WINDOW (w_current->sewindow), GTK_WIN_POS_MOUSE);

    gtk_dialog_set_default_response (GTK_DIALOG (w_current->sewindow),
                                     GTK_RESPONSE_ACCEPT);

    g_signal_connect (G_OBJECT (w_current->sewindow), "response",
                      G_CALLBACK (slot_edit_dialog_response),
                      w_current);

    gtk_container_set_border_width (GTK_CONTAINER (w_current->sewindow),
                                    DIALOG_BORDER_SPACING);
    vbox = GTK_DIALOG(w_current->sewindow)->vbox;
    gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);

    label[0] = gschem_dialog_misc_create_property_label (_("Number of Slots:"));
    label[1] = gschem_dialog_misc_create_property_label (_("Slot Number:"));

    widget[0] = gtk_entry_new();
    gtk_entry_set_max_length(GTK_ENTRY(widget[0]), 80);
    gtk_editable_set_editable (GTK_EDITABLE(widget[0]), FALSE);
	gtk_widget_set_sensitive (GTK_WIDGET(widget[0]), FALSE);

	widget[1] = gtk_entry_new();
    gtk_entry_set_max_length(GTK_ENTRY(widget[1]), 80);
    gtk_entry_set_activates_default (GTK_ENTRY(widget[1]),TRUE);

    table = gschem_dialog_misc_create_property_table(label, widget, 2);

	gtk_box_pack_start (GTK_BOX (vbox),                          /* box     */
                        table,                                   /* child   */
                        FALSE,                                   /* expand  */
                        FALSE,                                   /* fill    */
                        0);                                      /* padding */

	GLADE_HOOKUP_OBJECT(w_current->sewindow, widget[0], "countentry");
    GLADE_HOOKUP_OBJECT(w_current->sewindow, widget[1], "textentry");
    gtk_widget_show_all (w_current->sewindow);
  }

  else { /* dialog already created */
    gtk_window_present (GTK_WINDOW(w_current->sewindow));
  }

  if (count != NULL) {
    widget[0] = GTK_WIDGET (g_object_get_data (G_OBJECT (w_current->sewindow),
                                               "countentry"));
    gtk_entry_set_text(GTK_ENTRY(widget[0]), count);
  }

  /* always set the current text and select the number of the slot */
  if (string != NULL) {
    widget[1] = GTK_WIDGET (g_object_get_data (G_OBJECT (w_current->sewindow),
                                               "textentry"));
    gtk_entry_set_text(GTK_ENTRY(widget[1]), string);
    gtk_editable_select_region (GTK_EDITABLE(widget[1]), 0, -1);
  }
}