static void textbox_item_paste (Sheet *sheet, ItemData *data) { g_return_if_fail (sheet != NULL); g_return_if_fail (IS_SHEET (sheet)); g_return_if_fail (data != NULL); g_return_if_fail (IS_TEXTBOX (data)); sheet_add_ghost_item (sheet, data); }
static void wire_item_paste (Sheet *sheet, ItemData *data) { g_return_if_fail (sheet != NULL); g_return_if_fail (IS_SHEET (sheet)); g_return_if_fail (data != NULL); g_return_if_fail (IS_WIRE (data)); sheet_add_ghost_item (sheet, data); }
static void place_cmd (GtkWidget *widget, Browser *br) { LibraryPart *library_part; char *part_name; Coords pos; Sheet *sheet; Part *part; GtkTreeModel *model; GtkTreeIter iter; GtkTreeSelection *selection; schematic_view_reset_tool (br->schematic_view); sheet = schematic_view_get_sheet (br->schematic_view); // Get the current selected row selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (br->list)); model = gtk_tree_view_get_model (GTK_TREE_VIEW (br->list)); if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) { return; } gtk_tree_model_get (model, &iter, 0, &part_name, -1); library_part = library_get_part (br->library, part_name); part = part_new_from_library_part (library_part); if (!part) { oregano_error (_("Unable to load required part")); return; } pos.x = pos.y = 0; item_data_set_pos (ITEM_DATA (part), &pos); sheet_connect_part_item_to_floating_group (sheet, (gpointer) br->schematic_view); sheet_select_all (sheet, FALSE); sheet_clear_ghosts (sheet); sheet_add_ghost_item (sheet, ITEM_DATA (part)); }
void part_browser_dnd (GtkSelectionData *selection_data, int x, int y) { LibraryPart *library_part; Coords pos; DndData *data; Sheet *sheet; Part *part; data = (DndData *) (gtk_selection_data_get_data (selection_data)); g_return_if_fail (data != NULL); pos.x = x; pos.y = y; sheet = schematic_view_get_sheet (data->schematic_view); snap_to_grid (sheet->grid, &pos.x, &pos.y); library_part = library_get_part (data->br->library, data->part_name); part = part_new_from_library_part (library_part); if (!part) { oregano_error (_("Unable to load required part")); return; } item_data_set_pos (ITEM_DATA (part), &pos); sheet_connect_part_item_to_floating_group (sheet, (gpointer) data->schematic_view); sheet_select_all (sheet, FALSE); sheet_clear_ghosts (schematic_view_get_sheet (data->schematic_view)); sheet_add_ghost_item (sheet, ITEM_DATA (part)); }