/*! \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); } }
static void preview_init (GschemPreview *preview) { struct event_reg_t { gchar *detailed_signal; GCallback c_handler; } drawing_area_events[] = { { "realize", G_CALLBACK (preview_callback_realize) }, { "expose_event", G_CALLBACK (x_event_expose) }, { "button_press_event", G_CALLBACK (preview_callback_button_press) }, { "configure_event", G_CALLBACK (x_event_configure) }, { "scroll_event", G_CALLBACK (preview_event_scroll) }, { NULL, NULL } }, *tmp; GschemToplevel *preview_w_current; preview_w_current = gschem_toplevel_new (); gschem_toplevel_set_toplevel (preview_w_current, s_toplevel_new ()); preview_w_current->toplevel->load_newer_backup_func = x_fileselect_load_backup; preview_w_current->toplevel->load_newer_backup_data = preview_w_current; o_text_set_rendered_bounds_func (preview_w_current->toplevel, o_text_get_rendered_bounds, preview_w_current); i_vars_set (preview_w_current); /* be sure to turn off scrollbars */ preview_w_current->scrollbars_flag = FALSE; /* be sure to turn off the grid */ gschem_options_set_grid_mode (preview_w_current->options, GRID_MODE_NONE); /* preview_w_current windows don't have toolbars */ preview_w_current->handleboxes = FALSE; preview_w_current->toolbars = FALSE; preview_w_current->drawing_area = GTK_WIDGET (preview); preview->preview_w_current = preview_w_current; preview->active = FALSE; preview->filename = NULL; preview->buffer = NULL; GSCHEM_PAGE_VIEW (preview)->page = s_page_new (preview->preview_w_current->toplevel, "preview"); gtk_widget_set_events (GTK_WIDGET (preview), GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK); for (tmp = drawing_area_events; tmp->detailed_signal != NULL; tmp++) { g_signal_connect (GTK_WIDGET (preview), tmp->detailed_signal, tmp->c_handler, preview_w_current); } }
/*! \brief Cycle grid mode to the next option * * \param options These options */ void gschem_options_cycle_grid_mode (GschemOptions *options) { GRID_MODE next_grid_mode; g_return_if_fail (options != NULL); next_grid_mode = (GRID_MODE) ((options->grid_mode + 1) % GRID_MODE_COUNT); gschem_options_set_grid_mode (options, next_grid_mode); }
/*! \private * \brief Update the grid mode in the model * * \param [in,out] widget This widget */ static void update_grid_mode_model (GschemOptionsWidget *widget, GtkWidget *button) { g_return_if_fail (widget != NULL); if (widget->options != NULL) { int index; for (index = 0; index < GRID_MODE_COUNT; index++) { if (widget->grid_radio[index] == button) { gschem_options_set_grid_mode (widget->options, index); break; } } } }