static void cursor_change (GtkTreeView *tree_view, DialogState *dd) { int matchno; int lastmatch = dd->matches->len - 1; GtkTreePath *path; gtk_tree_view_get_cursor (tree_view, &path, NULL); if (path) { matchno = gtk_tree_path_get_indices (path)[0]; gtk_tree_path_free (path); } else { matchno = -1; } gtk_widget_set_sensitive (dd->prev_button, matchno > 0); gtk_widget_set_sensitive (dd->next_button, matchno >= 0 && matchno < lastmatch); if (matchno >= 0 && matchno <= lastmatch) { GnmSearchFilterResult *item = g_ptr_array_index (dd->matches, matchno); int col = item->ep.eval.col; int row = item->ep.eval.row; WorkbookControl *wbc = WORKBOOK_CONTROL (dd->wbcg); WorkbookView *wbv = wb_control_view (wbc); SheetView *sv; if (!sheet_is_visible (item->ep.sheet)) return; if (wb_control_cur_sheet (wbc) != item->ep.sheet) wb_view_sheet_focus (wbv, item->ep.sheet); sv = wb_view_cur_sheet_view (wbv); sv_set_edit_pos (sv, &item->ep.eval); sv_selection_set (sv, &item->ep.eval, col, row, col, row); sv_make_cell_visible (sv, col, row, FALSE); sv_update (sv); } }
SheetView * wb_control_cur_sheet_view (WorkbookControl const *wbc) { g_return_val_if_fail (IS_WORKBOOK_CONTROL (wbc), NULL); return wb_view_cur_sheet_view (wbc->wb_view); }