Commit a4ba034b authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Improve the look of diagonal double borders. They still handle


2000-07-16  Jody Goldberg <jgoldberg@home.com>

	* src/border.c (style_border_draw) : Improve the look of diagonal double
	  borders.  They still handle intersections poorly, but this improves
	  things a bit.
	(style_border_print) : Ditto.

2000-07-16  Jody Goldberg <jgoldberg@home.com>
	For : Matt Bissiri <bissiri@eecs.umich.edu>

	* src/clipboard.c: Implemented 'paste link' and 'skip blanks' for paste special.
	(paste_link): New function.
	(paste_cell): Do not clear the target cells if PASTE_SKIP_BLANKS is specified.
	Call paste_link if PASTE_LINK is specified.

	* src/clipboard.h:
	Added PASTE_LINK and PASTE_SKIP_BLANKS flags.

	* src/dialogs/dialog-paste-special.c:
	(transpose_cb): Rename transpose_cb -> checkbutton_toggled.
	(dialog_destroy): New function.
	(paste_link_set_sensitive): New function.
	(dialog_paste_special): Add 'paste link' and 'skip blanks' to the dialog.
parent 481e62b8
......@@ -73,8 +73,6 @@ Dialogs
: Editing nested functions. How best to express this.
: Switching between multiple function at the same level.
: Better communication and handling of parse errors.
- Name Guru
: Ick. This is very ugly.
Sorting
-------
......
2000-07-16 Jody Goldberg <jgoldberg@home.com>
* src/border.c (style_border_draw) : Improve the look of diagonal double
borders. They still handle intersections poorly, but this improves
things a bit.
(style_border_print) : Ditto.
2000-07-16 Jody Goldberg <jgoldberg@home.com>
For : Matt Bissiri <bissiri@eecs.umich.edu>
* src/clipboard.c: Implemented 'paste link' and 'skip blanks' for paste special.
(paste_link): New function.
(paste_cell): Do not clear the target cells if PASTE_SKIP_BLANKS is specified.
Call paste_link if PASTE_LINK is specified.
* src/clipboard.h:
Added PASTE_LINK and PASTE_SKIP_BLANKS flags.
* src/dialogs/dialog-paste-special.c:
(transpose_cb): Rename transpose_cb -> checkbutton_toggled.
(dialog_destroy): New function.
(paste_link_set_sensitive): New function.
(dialog_paste_special): Add 'paste link' and 'skip blanks' to the dialog.
2000-07-13 Michael Meeks <michael@helixcode.com>
* src/main.c (gnumeric_main): remove bonobo_shutdown.
......
2000-07-16 Jody Goldberg <jgoldberg@home.com>
* src/border.c (style_border_draw) : Improve the look of diagonal double
borders. They still handle intersections poorly, but this improves
things a bit.
(style_border_print) : Ditto.
2000-07-16 Jody Goldberg <jgoldberg@home.com>
For : Matt Bissiri <bissiri@eecs.umich.edu>
* src/clipboard.c: Implemented 'paste link' and 'skip blanks' for paste special.
(paste_link): New function.
(paste_cell): Do not clear the target cells if PASTE_SKIP_BLANKS is specified.
Call paste_link if PASTE_LINK is specified.
* src/clipboard.h:
Added PASTE_LINK and PASTE_SKIP_BLANKS flags.
* src/dialogs/dialog-paste-special.c:
(transpose_cb): Rename transpose_cb -> checkbutton_toggled.
(dialog_destroy): New function.
(paste_link_set_sensitive): New function.
(dialog_paste_special): Add 'paste link' and 'skip blanks' to the dialog.
2000-07-13 Michael Meeks <michael@helixcode.com>
* src/main.c (gnumeric_main): remove bonobo_shutdown.
......
......@@ -22,7 +22,7 @@ Jukka:
* Started the implementation of COUPDAYBS and COUPDAYS.
Matthew D. Bissiri:
* Paste special arithmetic operations.
* Paste special arithmetic operations, skip blanks, paste link.
Michael Levy:
* Improve the colour combo box.
......
2000-07-16 Jody Goldberg <jgoldberg@home.com>
* src/border.c (style_border_draw) : Improve the look of diagonal double
borders. They still handle intersections poorly, but this improves
things a bit.
(style_border_print) : Ditto.
2000-07-16 Jody Goldberg <jgoldberg@home.com>
For : Matt Bissiri <bissiri@eecs.umich.edu>
* src/clipboard.c: Implemented 'paste link' and 'skip blanks' for paste special.
(paste_link): New function.
(paste_cell): Do not clear the target cells if PASTE_SKIP_BLANKS is specified.
Call paste_link if PASTE_LINK is specified.
* src/clipboard.h:
Added PASTE_LINK and PASTE_SKIP_BLANKS flags.
* src/dialogs/dialog-paste-special.c:
(transpose_cb): Rename transpose_cb -> checkbutton_toggled.
(dialog_destroy): New function.
(paste_link_set_sensitive): New function.
(dialog_paste_special): Add 'paste link' and 'skip blanks' to the dialog.
2000-07-13 Michael Meeks <michael@helixcode.com>
* src/main.c (gnumeric_main): remove bonobo_shutdown.
......
2000-07-16 Jody Goldberg <jgoldberg@home.com>
* src/border.c (style_border_draw) : Improve the look of diagonal double
borders. They still handle intersections poorly, but this improves
things a bit.
(style_border_print) : Ditto.
2000-07-16 Jody Goldberg <jgoldberg@home.com>
For : Matt Bissiri <bissiri@eecs.umich.edu>
* src/clipboard.c: Implemented 'paste link' and 'skip blanks' for paste special.
(paste_link): New function.
(paste_cell): Do not clear the target cells if PASTE_SKIP_BLANKS is specified.
Call paste_link if PASTE_LINK is specified.
* src/clipboard.h:
Added PASTE_LINK and PASTE_SKIP_BLANKS flags.
* src/dialogs/dialog-paste-special.c:
(transpose_cb): Rename transpose_cb -> checkbutton_toggled.
(dialog_destroy): New function.
(paste_link_set_sensitive): New function.
(dialog_paste_special): Add 'paste link' and 'skip blanks' to the dialog.
2000-07-13 Michael Meeks <michael@helixcode.com>
* src/main.c (gnumeric_main): remove bonobo_shutdown.
......
2000-07-16 Jody Goldberg <jgoldberg@home.com>
* src/border.c (style_border_draw) : Improve the look of diagonal double
borders. They still handle intersections poorly, but this improves
things a bit.
(style_border_print) : Ditto.
2000-07-16 Jody Goldberg <jgoldberg@home.com>
For : Matt Bissiri <bissiri@eecs.umich.edu>
* src/clipboard.c: Implemented 'paste link' and 'skip blanks' for paste special.
(paste_link): New function.
(paste_cell): Do not clear the target cells if PASTE_SKIP_BLANKS is specified.
Call paste_link if PASTE_LINK is specified.
* src/clipboard.h:
Added PASTE_LINK and PASTE_SKIP_BLANKS flags.
* src/dialogs/dialog-paste-special.c:
(transpose_cb): Rename transpose_cb -> checkbutton_toggled.
(dialog_destroy): New function.
(paste_link_set_sensitive): New function.
(dialog_paste_special): Add 'paste link' and 'skip blanks' to the dialog.
2000-07-13 Michael Meeks <michael@helixcode.com>
* src/main.c (gnumeric_main): remove bonobo_shutdown.
......
2000-07-16 Jody Goldberg <jgoldberg@home.com>
* src/border.c (style_border_draw) : Improve the look of diagonal double
borders. They still handle intersections poorly, but this improves
things a bit.
(style_border_print) : Ditto.
2000-07-16 Jody Goldberg <jgoldberg@home.com>
For : Matt Bissiri <bissiri@eecs.umich.edu>
* src/clipboard.c: Implemented 'paste link' and 'skip blanks' for paste special.
(paste_link): New function.
(paste_cell): Do not clear the target cells if PASTE_SKIP_BLANKS is specified.
Call paste_link if PASTE_LINK is specified.
* src/clipboard.h:
Added PASTE_LINK and PASTE_SKIP_BLANKS flags.
* src/dialogs/dialog-paste-special.c:
(transpose_cb): Rename transpose_cb -> checkbutton_toggled.
(dialog_destroy): New function.
(paste_link_set_sensitive): New function.
(dialog_paste_special): Add 'paste link' and 'skip blanks' to the dialog.
2000-07-13 Michael Meeks <michael@helixcode.com>
* src/main.c (gnumeric_main): remove bonobo_shutdown.
......
2000-07-16 Jody Goldberg <jgoldberg@home.com>
* src/border.c (style_border_draw) : Improve the look of diagonal double
borders. They still handle intersections poorly, but this improves
things a bit.
(style_border_print) : Ditto.
2000-07-16 Jody Goldberg <jgoldberg@home.com>
For : Matt Bissiri <bissiri@eecs.umich.edu>
* src/clipboard.c: Implemented 'paste link' and 'skip blanks' for paste special.
(paste_link): New function.
(paste_cell): Do not clear the target cells if PASTE_SKIP_BLANKS is specified.
Call paste_link if PASTE_LINK is specified.
* src/clipboard.h:
Added PASTE_LINK and PASTE_SKIP_BLANKS flags.
* src/dialogs/dialog-paste-special.c:
(transpose_cb): Rename transpose_cb -> checkbutton_toggled.
(dialog_destroy): New function.
(paste_link_set_sensitive): New function.
(dialog_paste_special): Add 'paste link' and 'skip blanks' to the dialog.
2000-07-13 Michael Meeks <michael@helixcode.com>
* src/main.c (gnumeric_main): remove bonobo_shutdown.
......
......@@ -62,8 +62,6 @@ Gnumeric Spread Sheet task list
* Filter font list by font encoding.
* Create a simplistic dialog (to map to font-bold yes/no).
* when copying and entire row or col we should also copy the row/col size.
* when cuting & pasting a cell that is inside a range on another cell grow
the range of the formula if the cell is pasted in a place where it grows
it boundaries.
......@@ -130,14 +128,7 @@ Gnumeric Spread Sheet task list
Object properties.
** Paste special
needs some little changes:
- When formulas are pasted with an operation,
the new ExprTree should be created with the operation.
** Style
Protection:
Bloqued/Hidden
......@@ -181,7 +172,7 @@ Gnumeric Spread Sheet task list
* Parser
- fully support R[-1]C[3] type references
- Improve error reporting.
- Improve error reporting.
* Internals
When filling large regions (ie, select, enter data, control-enter),
......@@ -225,7 +216,7 @@ Gnumeric Spread Sheet task list
* Html export
* Export style information for blank cells.
* Graphics component
* Graph component
- Scatter plots are not being scaled to the dimensions of the allocated
size for the graph inside the layout.
- Stacked, and Stacked 100% are not working for line plots.
......
......@@ -1662,21 +1662,27 @@ gnumeric_convert (FunctionEvalInfo *ei, Value **argv)
static char *help_erf = {
N_("@FUNCTION=ERF\n"
"@SYNTAX=ERF(lower limit[,upper_limit])\n"
"@SYNTAX=ERF([lower limit,]upper_limit)\n"
"@DESCRIPTION="
"ERF function returns the integral of the error function "
"between the limits. If the @upper_limit ommitted ERF returns "
"the integral between zero and the @lower_limit."
"With a single argument ERF returns the error function, defined as "
"erf(x) = 2/sqrt(pi)* integral from 0 to x of exp(-t*t) dt. "
"If two arguments are supplied, they are the lower and upper "
"limits of the integral."
"\n"
"If either @lower_limit or @upper_limit are not numeric a "
"If either @lower_limit or @upper_limit is not numeric a "
"#VALUE! error is returned. "
"If either @lower_limit or @upper_limit are < 0 a #NUM! error "
"is returned. "
"This function is Excel compatible. "
"This function is upward-compatible with that in Excel. "
"(If two arguments are supplied, "
"Excel will not allow either to be negative.) "
"\n"
"@EXAMPLES=\n"
"ERF(0.4) equals 0.428392355.\n"
"ERF(1.6448536269515/SQRT(2)) equals 0.90.\n"
"\n"
"The second example shows that a random variable with a normal "
"distribution has a 90 percent chance of falling within "
"approximately 1.645 standard deviations of the mean."
"\n"
"@SEEALSO=ERFC")
};
......@@ -1688,16 +1694,13 @@ gnumeric_erf (FunctionEvalInfo *ei, Value **argv)
float_t ans, lower, upper=0.0;
lower = value_get_as_float (argv [0]);
if (argv [1])
upper = value_get_as_float (argv [1]);
if (lower < 0.0 || upper < 0.0)
return value_new_error (ei->pos, gnumeric_err_NUM);
ans = erf(lower);
if (argv [1])
ans = erf(upper) - ans;
{
upper = value_get_as_float (argv [1]);
ans = erf(upper) - ans;
}
return value_new_float (ans);
}
......@@ -1709,13 +1712,15 @@ static char *help_erfc = {
"@SYNTAX=ERFC(x)\n"
"@DESCRIPTION="
"The ERFC function returns the integral of the complimentary "
"error function between the limits 0 and @x."
"The ERFC function returns the complimentary "
"error function, defined as 1 - erf(x). "
"erfc(x) is calculated more accurately than erf(x) for "
"arguments larger than about 0.5."
"\n"
"If @x is not numeric a #VALUE! error is returned. "
"If @x < 0 a #NUM! error is returned."
"\n"
"@EXAMPLES=\n"
"ERFC(6) equals 2.15197367e-17.\n"
"\n"
"@SEEALSO=ERF")
};
......@@ -1725,8 +1730,7 @@ gnumeric_erfc (FunctionEvalInfo *ei, Value **argv)
{
float_t x;
if ((x=value_get_as_float (argv [0]))<0)
return value_new_error (ei->pos, gnumeric_err_NUM);
x=value_get_as_float (argv [0]);
return value_new_float (erfc (x));
}
......
......@@ -329,16 +329,16 @@ style_border_draw (MStyleBorder const * const border, MStyleElementType const t,
{ { 0,-1,0,-1}, { 0,1,0,1} }, /* BOTTOM */
{ { -1,0,-1,0}, { 1,0,1,0} }, /* LEFT */
{ { -1,0,-1,0}, { 1,0,1,0} }, /* RIGHT */
{ { 0,1,-1,0}, { 1,0,0,-1} }, /* DIAGONAL */
{ { 0,-1,-1,0 },{ 1,0,0,1} }, /* REV_DIAGONAL */
{ { 0,-2,-2,0 },{ 2,0,0,2} }, /* REV_DIAGONAL */
{ { 0,2,-2,0}, { 2,0,0,-2} }, /* DIAGONAL */
};
static int const extension_begin[][2][2] = {
{ { -1, 0 }, { 1, 0 } }, /* TOP */
{ { 1, 0 }, { -1, 0 } }, /* BOTTOM */
{ { 0, -1 }, { 0, 1} }, /* LEFT */
{ { 0, 1 }, { 0, -1} }, /* RIGHT */
{ { 1, 1}, { 1, 1 } }, /* DIAGONAL */
{ { -1, -1}, { -1, -1} }, /* REV_DIAGONAL */
{ { 1, 1}, { 1, 1 } }, /* DIAGONAL */
};
int const i = t-MSTYLE_BORDER_TOP;
......@@ -387,16 +387,16 @@ style_border_print (MStyleBorder const * const border, MStyleElementType const t
{ { 0,-1,0,-1}, { 0,1,0,1} }, /* BOTTOM */
{ { -1,0,-1,0}, { 1,0,1,0} }, /* LEFT */
{ { -1,0,-1,0}, { 1,0,1,0} }, /* RIGHT */
{ { 0,1,-1,0}, { 1,0,0,-1} }, /* DIAGONAL */
{ { 0,-1,-1,0 },{ 1,0,0,1} }, /* REV_DIAGONAL */
{ { 0,-2,-2,0 },{ 2,0,0,2} }, /* REV_DIAGONAL */
{ { 0,2,-2,0}, { 2,0,0,-2} }, /* DIAGONAL */
};
static int const extension_begin[][2][2] = {
{ { -1, 0 }, { 1, 0 } }, /* TOP */
{ { 1, 0 }, { -1, 0 } }, /* BOTTOM */
{ { 0, -1 }, { 0, 1} }, /* LEFT */
{ { 0, 1 }, { 0, -1} }, /* RIGHT */
{ { 1, 1}, { 1, 1 } }, /* DIAGONAL */
{ { -1, -1}, { -1, -1} }, /* REV_DIAGONAL */
{ { 1, 1}, { 1, 1 } }, /* DIAGONAL */
};
int const i = t-MSTYLE_BORDER_TOP;
......
......@@ -110,8 +110,7 @@ apply_paste_oper_to_values (Cell const * old_cell, Cell const * copied_cell, int
return value_new_float (old_float * copied_float);
else if (paste_flags & PASTE_OPER_DIV)
return (copied_float == 0.0)
? value_new_error (NULL, /* FIXME: Why do value_new_error and value_new_error_str take the EvalPos argument? The EvalPos is not currently used in those functions. */
gnumeric_err_DIV0)
? value_new_error (NULL, gnumeric_err_DIV0)
: value_new_float (old_float / copied_float);
else
g_assert_not_reached ();
......@@ -187,6 +186,27 @@ paste_cell_with_operation (Sheet *dest_sheet,
sheet_cell_insert (dest_sheet, new_cell, target_col, target_row);
}
static void
paste_link (Sheet *dest_sheet,
int source_col, int source_row,
int target_col, int target_row)
{
ExprTree *expr;
Cell *new_cell;
CellRef source_cell_ref;
new_cell = sheet_cell_new (dest_sheet, target_col, target_row);
source_cell_ref.sheet = dest_sheet;
source_cell_ref.col = source_col;
source_cell_ref.row = source_row;
source_cell_ref.col_relative = 0;
source_cell_ref.row_relative = 0;
expr = expr_tree_new_var (&source_cell_ref);
sheet_cell_set_expr (new_cell, expr);
}
/**
* paste_cell: Pastes a cell in the spreadsheet
*
......@@ -312,7 +332,7 @@ clipboard_paste_region (CommandContext *context,
tmp = CLEAR_VALUES|CLEAR_COMMENTS;
if (pt->paste_flags & PASTE_FORMATS)
tmp |= CLEAR_FORMATS;
if (pt->paste_flags & PASTE_OPER_MASK)
if (pt->paste_flags & (PASTE_OPER_MASK | PASTE_SKIP_BLANKS))
tmp = 0;
if (tmp) {
int const dst_col = pt->range.start.col;
......@@ -385,8 +405,15 @@ clipboard_paste_region (CommandContext *context,
rinfo->pos.eval.row = target_row;
}
paste_cell (pt->sheet, target_col, target_row,
&rwinfo, c_copy, pt->paste_flags);
if (pt->paste_flags & PASTE_LINK) {
int source_col = content->base_col + c_copy->col_offset;
int source_row = content->base_row + c_copy->row_offset;
paste_link (pt->sheet, source_col, source_row,
target_col, target_row);
} else
paste_cell (pt->sheet, target_col, target_row,
&rwinfo, c_copy, pt->paste_flags);
}
}
......
......@@ -14,7 +14,14 @@ enum {
/* Whether the paste transposes or not */
PASTE_TRANSPOSE = 1 << 7,
PASTE_EXPR_RELOCATE = 1 << 8
PASTE_EXPR_RELOCATE = 1 << 8,
PASTE_LINK = 1 << 9,
/* If copying a range that includes blank cells, this
prevents pasting blank cells over existing data */
PASTE_SKIP_BLANKS = 1 << 10
};
#define PASTE_ALL_TYPES (PASTE_FORMULAS | PASTE_VALUES | PASTE_FORMATS)
......@@ -29,7 +36,7 @@ typedef enum {
typedef struct {
int col_offset, row_offset; /* Position of the cell */
guint8 type;
CellCopyType type;
char *comment;
union {
Cell *cell;
......
2000-07-15 Jody Goldberg <jgoldberg@home.com>
* dialog-define-names.c (name_guru_populate_list) : Lookup sheet local
names too.
(cb_name_guru_add) : Parse at the edit position.
2000-07-09 Jody Goldberg <jgoldberg@home.com>
* dialog-cell-format.c (cb_font_changed) : Update to handle new
......
......@@ -25,8 +25,9 @@ typedef struct {
GtkList *list;
GtkEntry *name;
GtkEntry *value;
GtkCombo *scope;
GList *expr_names;
gint selected;
NamedExpression *cur_name;
GtkWidget *ok_button;
GtkWidget *add_button;
......@@ -34,8 +35,36 @@ typedef struct {
GtkWidget *delete_button;
Workbook *wb;
Sheet *sheet;
} NameGuruState;
static void
cb_scope_changed (GtkEntry *entry, NameGuruState *state)
{
if (state->cur_name != NULL)
puts("changed");
}
static void
name_guru_init_scope (NameGuruState *state)
{
NamedExpression *cur = state->cur_name;
GList *list = NULL;
if (cur != NULL && cur->sheet) {
list = g_list_prepend (list, _("Workbook"));
list = g_list_prepend (list, cur->sheet->name_unquoted);
} else {
list = g_list_prepend (list, state->sheet->name_unquoted);
list = g_list_prepend (list, _("Workbook"));
}
state->cur_name = NULL;
gtk_combo_set_popdown_strings (state->scope, list);
g_list_free (list);
state->cur_name = cur;
}
static void
cb_name_guru_select_name (GtkWidget *list, NameGuruState *state)
{
......@@ -50,9 +79,12 @@ cb_name_guru_select_name (GtkWidget *list, NameGuruState *state)
expr_name = gtk_object_get_data (GTK_OBJECT (sel->data), LIST_KEY);
g_return_if_fail (expr_name != NULL);
g_return_if_fail (expr_name->name != NULL);
g_return_if_fail (expr_name->name->str != NULL);
state->cur_name = expr_name;
/* Display the name */
gtk_entry_set_text (state->name, expr_name->name->str);
......@@ -60,6 +92,9 @@ cb_name_guru_select_name (GtkWidget *list, NameGuruState *state)
txt = expr_name_value (expr_name);
gtk_entry_set_text (state->value, txt);
g_free (txt);
/* Init the scope combo box */
name_guru_init_scope (state);
}
static void
......@@ -71,17 +106,25 @@ name_guru_populate_list (NameGuruState *state)
g_return_if_fail (state != NULL);
g_return_if_fail (state->list != NULL);
state->selected = -1;
state->cur_name = NULL;
if (state->expr_names != NULL)
g_list_free (state->expr_names);
/* FIXME: scoping issues here */
names = state->expr_names = expr_name_list (state->wb, NULL, FALSE);
state->expr_names = expr_name_list (state->wb, state->sheet, FALSE);
list = GTK_CONTAINER (state->list);
for (; names != NULL ; names = g_list_next (names)) {
for (names = state->expr_names ; names != NULL ; names = g_list_next (names)) {
NamedExpression *expr_name = names->data;
GtkWidget *li = gtk_list_item_new_with_label (expr_name->name->str);
GtkWidget *li;
if (expr_name->sheet != NULL) {
char *name = g_strdup_printf ("%s!%s",
expr_name->sheet->name_unquoted,
expr_name->name->str);
li = gtk_list_item_new_with_label (name);
g_free (name);
} else
li = gtk_list_item_new_with_label (expr_name->name->str);
gtk_object_set_data (GTK_OBJECT (li), LIST_KEY, expr_name);
gtk_container_add (list, li);
}
......@@ -91,12 +134,10 @@ name_guru_populate_list (NameGuruState *state)
static void
cb_name_guru_remove (GtkWidget *ignored, NameGuruState *state)
{
gint i;
g_return_if_fail (state != NULL);
i = state->selected;
if (i >= 0) {
GList *na = g_list_nth (state->expr_names, i);
if (state->cur_name != NULL) {
GList *na = g_list_remove (state->expr_names, state->cur_name);
g_return_if_fail (na != NULL);
g_return_if_fail (na->data != NULL);
......@@ -132,7 +173,9 @@ cb_name_guru_add (NameGuruState *state)
*
* default to workbook for now.
*/
pp = parse_pos_init (&pos, state->wb, NULL, 0, 0);
pp = parse_pos_init (&pos, state->wb, state->sheet,
state->sheet->cursor.edit_pos.col,
state->sheet->cursor.edit_pos.row);
expr_name = expr_name_lookup (pp, name);
......@@ -229,19 +272,27 @@ cb_name_guru_destroy (GtkObject *w, NameGuruState *state)
}
static gboolean
name_guru_init (NameGuruState *state)
name_guru_init (NameGuruState *state, Workbook *wb)
{
state->wb = wb;
state->sheet = wb->current_sheet;
state->gui = gnumeric_glade_xml_new (workbook_command_context_gui (state->wb),
"names.glade");
if (state->gui == NULL)
return TRUE;
state->dialog = glade_xml_get_widget (state->gui, "NamesDialog");
state->dialog = glade_xml_get_widget (state->gui, "NameGuru");
state->name = GTK_ENTRY (glade_xml_get_widget (state->gui, "name"));
state->value = GTK_ENTRY (glade_xml_get_widget (state->gui, "value"));
state->scope = GTK_COMBO (glade_xml_get_widget (state->gui, "scope_combo"));
state->list = GTK_LIST (glade_xml_get_widget (state->gui, "name_list"));
state->expr_names = NULL;
state->selected = -1;
state->cur_name = NULL;
/* Init the scope combo box */
name_guru_init_scope (state);
gtk_signal_connect (GTK_OBJECT (state->scope->entry), "changed",
GTK_SIGNAL_FUNC (cb_scope_changed), state);
state->ok_button = name_guru_init_button (state, "ok_button");
state->close_button = name_guru_init_button (state, "close_button");
......@@ -261,6 +312,8 @@ name_guru_init (NameGuruState *state)
GTK_EDITABLE(state->name));
gnumeric_editable_enters (GTK_WINDOW (state->dialog),
GTK_EDITABLE (state->value));
gnumeric_combo_enters (GTK_WINDOW (state->dialog),
state->scope);
gnumeric_non_modal_dialog (state->wb, GTK_DIALOG (state->dialog));
workbook_edit_attach_guru (state->wb, state->dialog);
......@@ -276,8 +329,7 @@ dialog_define_names (Workbook *wb)
g_return_if_fail (wb != NULL);
state = g_new (NameGuruState, 1);
state->wb = wb;
if (name_guru_init (state)) {
if (name_guru_init (state, wb)) {
g_free (state);
return;
}
......
......@@ -13,6 +13,10 @@
#include "eval.h"
#include "dialogs.h"
#define BUTTON_OK 0
#define BUTTON_CANCEL BUTTON_OK + 1
#define BUTTON_PASTE_LINK BUTTON_CANCEL + 1
static struct {
char *name;
int disables_second_group;
......@@ -33,6 +37,14 @@ static char *paste_ops [] = {
NULL
};
typedef struct {
GnomeDialog *dialog;
GSList *group_type;
GSList *group_ops;
GtkToggleButton *transpose;
GtkToggleButton *skip_blanks;
} PasteSpecialState;
static void
disable_op_group (GtkWidget *widget, GtkWidget *group)
{
......@@ -46,25 +58,56 @@ enable_op_group (GtkWidget *widget, GtkWidget *group)
}
static void
transpose_cb (GtkToggleButton *widget, gboolean *transpose_b)
checkbutton_toggled (GtkWidget *widget, gboolean *flag)
{
*flag = GTK_TOGGLE_BUTTON (widget)->active;
}
static gboolean
dialog_destroy (GtkObject *w, PasteSpecialState *state)
{
g_free (state);
return FALSE;
}
/* The "Paste Link" button should be grayed-out, unless type "All" is
selected, operation "None" is selected, and "Transpose" and "Skip
Blanks" are not selected. */
static void
paste_link_set_sensitive (GtkWidget *widget, PasteSpecialState *state)
{
*transpose_b = widget->active;
gboolean sensitive =
(gtk_radio_group_get_selected (state->group_type) == 0) &&
(gtk_radio_group_get_selected (state->group_ops) == 0) &&
!state->transpose->active &&
!state->skip_blanks->active;
gnome_dialog_set_sensitive (state->dialog,
BUTTON_PASTE_LINK, sensitive);
}
int
dialog_paste_special (Workbook *wb)
{
GtkWidget *dialog, *hbox;
GtkWidget *f1, *f1v, *f2, *f2v, *cb, *first_button = NULL;
GSList *group_type, *group_ops;
GtkWidget *hbox, *vbox;
GtkWidget *f1, *f1v, *f2, *f2v, *first_button = NULL;
int result, i;
int v;
gboolean do_transpose = FALSE;
gboolean do_skip_blanks = FALSE;
PasteSpecialState *state;
state = g_new (PasteSpecialState, 1);
dialog = gnome_dialog_new (_("Paste special"),
GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_CANCEL,
NULL);
state->dialog =
GNOME_DIALOG (gnome_dialog_new (_("Paste special"),
GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_CANCEL,