Exemple #1
0
/*! \brief Set a property
 *
 *  \param [in,out] object
 *  \param [in]     param_id
 *  \param [in]     value
 *  \param [in]     pspec
 */
static void
set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec)
{
  GschemOptions *options = GSCHEM_OPTIONS (object);

  switch (param_id) {
    case PROP_GRID_MODE:
      gschem_options_set_grid_mode (options, (GRID_MODE) g_value_get_int (value));
      break;

    case PROP_MAGNETIC_NET_MODE:
      gschem_options_set_magnetic_net_mode (options, g_value_get_boolean (value));
      break;

    case PROP_NET_RUBBER_BAND_MODE:
      gschem_options_set_net_rubber_band_mode (options, g_value_get_boolean (value));
      break;

    case PROP_SNAP_MODE:
      gschem_options_set_snap_mode (options, (SNAP_STATE) g_value_get_int (value));
      break;

    case PROP_SNAP_SIZE:
      gschem_options_set_snap_size (options, g_value_get_int (value));
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
  }
}
Exemple #2
0
/*! \brief Cycle net rubber band mode to the next option
 *
 *  \param options These options
 */
void
gschem_options_cycle_net_rubber_band_mode (GschemOptions *options)
{
  gboolean next_net_rubber_band_mode;

  g_return_if_fail (options != NULL);

  next_net_rubber_band_mode = !options->net_rubber_band_mode;

  gschem_options_set_net_rubber_band_mode (options, next_net_rubber_band_mode);
}
/*! \private
 *  \brief Update the net rubber band mode in the model
 *
 *  \param [in,out] widget This widget
 */
static void
update_net_rubber_band_mode_model (GschemOptionsWidget *widget)
{
  GschemToplevel *w_current;

  g_return_if_fail (widget != NULL);

  g_object_get (widget, "gschem-toplevel", &w_current, NULL);

  g_return_if_fail (w_current != NULL);

  gschem_options_set_net_rubber_band_mode (w_current->options,
                                           gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget->net_rubber_band_widget)));
}