Ejemplo n.º 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);
  }
}
Ejemplo n.º 2
0
/*! \brief Scale the snap size up
 *
 *  \param [in] options These options
 */
void
gschem_options_scale_snap_up (GschemOptions *options)
{
  g_return_if_fail (options != NULL);

  gschem_options_set_snap_size (options, options->snap_size * 2);
}
Ejemplo n.º 3
0
/*! \brief Scale the snap size down
 *
 *  \param [in] options These options
 */
void
gschem_options_scale_snap_down (GschemOptions *options)
{
  g_return_if_fail (options != NULL);

  if ((options->snap_size % 2) == 0) {
    gschem_options_set_snap_size (options, options->snap_size / 2);
  }
}
Ejemplo n.º 4
0
/*! \private
 *  \brief Update the snap size in the model
 *
 *  \param [in,out] widget This widget
 */
static void
update_snap_size_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_snap_size (w_current->options,
                                gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget->snap_size)));
}