示例#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);
  }
}
示例#2
0
/*! \brief Cycle snap mode to the next option
 *
 *  \param options These options
 */
void
gschem_options_cycle_snap_mode (GschemOptions *options)
{
  SNAP_STATE next_snap_mode;

  g_return_if_fail (options != NULL);

  /* toggle to the next snap state */
  next_snap_mode = (SNAP_STATE) ((options->snap_mode + 1) % SNAP_STATE_COUNT);

  gschem_options_set_snap_mode (options, next_snap_mode);
}
示例#3
0
/*! \private
 *  \brief Update the snap mode in the model
 *
 *  \param [in,out] widget This widget
 */
static void
update_snap_mode_model (GschemOptionsWidget *widget, GtkWidget *button)
{
  g_return_if_fail (widget != NULL);

  if (widget->options != NULL) {
    int index;

    for (index = 0; index < SNAP_STATE_COUNT; index++) {
      if (widget->snap_radio[index] == button) {
        gschem_options_set_snap_mode (widget->options, index);
        break;
      }
    }
  }
}