Commit 3529e4fb authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Implement querying for cell comments.

2001-10-02  Morten Welinder  <terra@diku.dk>

	* src/commands.c (cmd_search_replace_do_cell): Implement querying
 	for cell comments.

	* src/search.h (SearchReplaceQuery): Add SRQ_querycommment.

	* src/workbook-control-gui.c (cb_edit_search_replace_query):
 	implement SRQ_querycommment.
parent 16493eca
2001-10-02 Morten Welinder <terra@diku.dk>
* src/commands.c (cmd_search_replace_do_cell): Implement querying
for cell comments.
* src/search.h (SearchReplaceQuery): Add SRQ_querycommment.
* src/workbook-control-gui.c (cb_edit_search_replace_query):
implement SRQ_querycommment.
2001-10-02 Jakub Steiner <jimmac@ximian.com>
* gnome-gnumeric.png: less detail so it looks better scaled down
......
2001-10-02 Morten Welinder <terra@diku.dk>
* src/commands.c (cmd_search_replace_do_cell): Implement querying
for cell comments.
* src/search.h (SearchReplaceQuery): Add SRQ_querycommment.
* src/workbook-control-gui.c (cb_edit_search_replace_query):
implement SRQ_querycommment.
2001-10-02 Jakub Steiner <jimmac@ximian.com>
* gnome-gnumeric.png: less detail so it looks better scaled down
......
2001-10-02 Morten Welinder <terra@diku.dk>
* src/commands.c (cmd_search_replace_do_cell): Implement querying
for cell comments.
* src/search.h (SearchReplaceQuery): Add SRQ_querycommment.
* src/workbook-control-gui.c (cb_edit_search_replace_query):
implement SRQ_querycommment.
2001-10-02 Jakub Steiner <jimmac@ximian.com>
* gnome-gnumeric.png: less detail so it looks better scaled down
......
2001-10-02 Morten Welinder <terra@diku.dk>
* src/commands.c (cmd_search_replace_do_cell): Implement querying
for cell comments.
* src/search.h (SearchReplaceQuery): Add SRQ_querycommment.
* src/workbook-control-gui.c (cb_edit_search_replace_query):
implement SRQ_querycommment.
2001-10-02 Jakub Steiner <jimmac@ximian.com>
* gnome-gnumeric.png: less detail so it looks better scaled down
......
......@@ -3509,8 +3509,18 @@ cmd_search_replace_do_cell (CmdSearchReplace *me, EvalPos *ep,
char *new_text = search_replace_string (sr, old_text);
if (new_text) {
gboolean doit = TRUE;
if (sr->query) {
/* FIXME. */
if (sr->query && sr->query_func) {
int res = sr->query_func (SRQ_querycommment,
sr,
ep->sheet,
&ep->eval,
old_text,
new_text);
if (res == -1) {
g_free (new_text);
return TRUE;
}
doit = (res == 0);
}
if (doit) {
......
......@@ -16,7 +16,8 @@ typedef enum { SRS_workbook = 0,
SRS_range } SearchReplaceScope;
typedef enum { SRQ_fail,
SRQ_query } SearchReplaceQuery;
SRQ_query,
SRQ_querycommment } SearchReplaceQuery;
typedef int (*SearchReplaceQueryFunc) (SearchReplaceQuery q, SearchReplace *sr, ...);
......@@ -52,6 +53,10 @@ struct _SearchReplace {
*
* SRQ_query (..., Cell *cell, const char *old, const char *new)
* Ask user whether to change. (-1=cancel, 0=yes, 1=no.)
*
* SRQ_querycommment (..., Sheet *sheet, CellPos *cp,
* const char *old, const char *new)
* Ask user whether to change. (-1=cancel, 0=yes, 1=no.)
*/
SearchReplaceQueryFunc query_func;
void *user_data;
......
......@@ -1704,21 +1704,34 @@ cb_edit_search_replace_query (SearchReplaceQuery q, SearchReplace *sr, ...)
const char *old_text = va_arg (pvar, const char *);
const char *new_text = va_arg (pvar, const char *);
char *pos_name;
ParsePos pp;
CellRef cr;
Sheet *sheet = cell->base.sheet;
int col = cell->pos.col;
int row = cell->pos.row;
cr.sheet = sheet;
cr.col = col;
cr.row = row;
cr.col_relative = 0;
cr.row_relative = 0;
pp.sheet = sheet;
pp.wb = sheet->workbook;
pp.eval = cell->pos;
WORKBOOK_FOREACH_VIEW (sheet->workbook, view, {
wb_view_sheet_focus (view, sheet);
});
sheet_selection_set (sheet, col, row, col, row, col, row);
sheet_make_cell_visible (sheet, col, row);
pos_name = g_strconcat (sheet->name_unquoted, "!",
cell_name (cell), NULL);
res = dialog_search_replace_query (wbcg, sr, pos_name,
old_text, new_text);
g_free (pos_name);
break;
}
case SRQ_querycommment: {
Sheet *sheet = va_arg (pvar, Sheet *);
CellPos *cp = va_arg (pvar, CellPos *);
const char *old_text = va_arg (pvar, const char *);
const char *new_text = va_arg (pvar, const char *);
char *pos_name;
int col = cp->col;
int row = cp->row;
WORKBOOK_FOREACH_VIEW (sheet->workbook, view, {
wb_view_sheet_focus (view, sheet);
......@@ -1726,7 +1739,9 @@ cb_edit_search_replace_query (SearchReplaceQuery q, SearchReplace *sr, ...)
sheet_selection_set (sheet, col, row, col, row, col, row);
sheet_make_cell_visible (sheet, col, row);
pos_name = cellref_name (&cr, &pp, FALSE);
pos_name = g_strdup_printf (_("Comment in cell %s!%s"),
sheet->name_unquoted,
cell_pos_name (cp));
res = dialog_search_replace_query (wbcg, sr, pos_name,
old_text, new_text);
g_free (pos_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment