static void interface_toggle_mainpoint_magnetism(GtkWidget *widget, gpointer data) { DDisplay *ddisp = (DDisplay *)data; ddisplay_set_snap_to_objects(ddisp, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); ddisplay_add_update_all(ddisp); ddisplay_flush(ddisp); }
/** * Sets the Object-snap property for the active display. * @param b Object snap toggle button. * @param not_used */ static void integrated_ui_toolbar_object_snap_toggle(GtkToggleButton *b, gpointer *not_used) { DDisplay *ddisp = ddisplay_active (); if (ddisp) { ddisplay_set_snap_to_objects (ddisp, gtk_toggle_button_get_active (b)); } }
void display_set_active(DDisplay *ddisp) { if (ddisp != active_display) { active_display = ddisp; /* perform notification here (such as switch layers dialog) */ layer_dialog_set_diagram(ddisp ? ddisp->diagram : NULL); diagram_properties_set_diagram(ddisp ? ddisp->diagram : NULL); if (ddisp) { if (ddisp->is_standalone_window) { display_update_menu_state(ddisp); if (prefs.toolbox_on_top) { gtk_window_set_transient_for(GTK_WINDOW(interface_get_toolbox_shell()), GTK_WINDOW(ddisp->shell)); } else { gtk_window_set_transient_for(GTK_WINDOW(interface_get_toolbox_shell()), NULL); } } else { GtkNotebook *notebook = g_object_get_data (G_OBJECT (ddisp->shell), DIA_MAIN_NOTEBOOK); /* Find the page with ddisp then set the label on the tab */ gint num_pages = gtk_notebook_get_n_pages (notebook); gint num; GtkWidget *page; for (num = 0 ; num < num_pages ; num++) { page = gtk_notebook_get_nth_page (notebook,num); if (g_object_get_data (G_OBJECT (page), "DDisplay") == ddisp) { gtk_notebook_set_current_page (notebook,num); break; } } /* synchronize_ui_to_active_display (ddisp); */ /* updates display title, etc */ diagram_modified(ddisp->diagram); /* ZOOM */ update_zoom_status (ddisp); /* Snap to grid */ ddisplay_set_snap_to_grid (ddisp, ddisp->grid.snap); /* menus */ /* Object snapping */ ddisplay_set_snap_to_objects (ddisp, ddisp->mainpoint_magnetism); display_update_menu_state (ddisp); gtk_window_present (GTK_WINDOW(ddisp->shell)); } } else { /* TODO: Prevent gtk_window_set_transient_for() in Integrated UI case */ gtk_window_set_transient_for(GTK_WINDOW(interface_get_toolbox_shell()), NULL); } } }