Commit 6d6cfe5c authored by Almer S. Tigelaar's avatar Almer S. Tigelaar Committed by Almer S. Tigelaar
Browse files

Implement. (workbook_cmd_format_row_std_height) : Idem.

2001-02-27  Almer S. Tigelaar  <almer@gnome.org>

	* src/workbook-cmd-format.c
	(workbook_cmd_format_column_std_width) : Implement.
	(workbook_cmd_format_row_std_height) : Idem.

	* src/commands.c, src/commands.h
	(cmd_colrow_std_size_undo) : New, Undo for the std row-height/col-width
	setting.
	(cmd_colrow_std_size_redo) : Idem, for redo.
	(cmd_colrow_std_size_destroy) : Idem.
	(cmd_colrow_std_size) : Entry point for std row-height/col-width command.
parent d920a215
2001-02-27 Almer S. Tigelaar <almer@gnome.org>
* src/workbook-cmd-format.c
(workbook_cmd_format_column_std_width) : Implement.
(workbook_cmd_format_row_std_height) : Idem.
* src/commands.c, src/commands.h
(cmd_colrow_std_size_undo) : New, Undo for the std row-height/col-width
setting.
(cmd_colrow_std_size_redo) : Idem, for redo.
(cmd_colrow_std_size_destroy) : Idem.
(cmd_colrow_std_size) : Entry point for std row-height/col-width command.
2001-02-25 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (zoom_changed) : round the zoom factor
......
2001-02-27 Almer S. Tigelaar <almer@gnome.org>
* src/workbook-cmd-format.c
(workbook_cmd_format_column_std_width) : Implement.
(workbook_cmd_format_row_std_height) : Idem.
* src/commands.c, src/commands.h
(cmd_colrow_std_size_undo) : New, Undo for the std row-height/col-width
setting.
(cmd_colrow_std_size_redo) : Idem, for redo.
(cmd_colrow_std_size_destroy) : Idem.
(cmd_colrow_std_size) : Entry point for std row-height/col-width command.
2001-02-25 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (zoom_changed) : round the zoom factor
......
2001-02-27 Almer S. Tigelaar <almer@gnome.org>
* src/workbook-cmd-format.c
(workbook_cmd_format_column_std_width) : Implement.
(workbook_cmd_format_row_std_height) : Idem.
* src/commands.c, src/commands.h
(cmd_colrow_std_size_undo) : New, Undo for the std row-height/col-width
setting.
(cmd_colrow_std_size_redo) : Idem, for redo.
(cmd_colrow_std_size_destroy) : Idem.
(cmd_colrow_std_size) : Entry point for std row-height/col-width command.
2001-02-25 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (zoom_changed) : round the zoom factor
......
2001-02-27 Almer S. Tigelaar <almer@gnome.org>
* src/workbook-cmd-format.c
(workbook_cmd_format_column_std_width) : Implement.
(workbook_cmd_format_row_std_height) : Idem.
* src/commands.c, src/commands.h
(cmd_colrow_std_size_undo) : New, Undo for the std row-height/col-width
setting.
(cmd_colrow_std_size_redo) : Idem, for redo.
(cmd_colrow_std_size_destroy) : Idem.
(cmd_colrow_std_size) : Entry point for std row-height/col-width command.
2001-02-25 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (zoom_changed) : round the zoom factor
......
2001-02-27 Almer S. Tigelaar <almer@gnome.org>
* src/workbook-cmd-format.c
(workbook_cmd_format_column_std_width) : Implement.
(workbook_cmd_format_row_std_height) : Idem.
* src/commands.c, src/commands.h
(cmd_colrow_std_size_undo) : New, Undo for the std row-height/col-width
setting.
(cmd_colrow_std_size_redo) : Idem, for redo.
(cmd_colrow_std_size_destroy) : Idem.
(cmd_colrow_std_size) : Entry point for std row-height/col-width command.
2001-02-25 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (zoom_changed) : round the zoom factor
......
......@@ -3181,6 +3181,92 @@ cmd_search_replace (WorkbookControl *wbc, Sheet *sheet, SearchReplace *sr)
return FALSE;
}
/******************************************************************/
#define CMD_COLROW_STD_SIZE_TYPE (cmd_colrow_std_size_get_type ())
#define CMD_COLROW_STD_SIZE(o) (GTK_CHECK_CAST ((o), CMD_COLROW_STD_SIZE_TYPE, CmdColRowStdSize))
typedef struct
{
GnumericCommand parent;
Sheet *sheet;
gboolean is_cols;
double new_default;
double old_default;
} CmdColRowStdSize;
GNUMERIC_MAKE_COMMAND (CmdColRowStdSize, cmd_colrow_std_size);
static gboolean
cmd_colrow_std_size_undo (GnumericCommand *cmd, WorkbookControl *wbc)
{
CmdColRowStdSize *me = CMD_COLROW_STD_SIZE (cmd);
g_return_val_if_fail (me != NULL, TRUE);
g_return_val_if_fail (me->old_default != 0, TRUE);
if (me->is_cols)
sheet_col_set_default_size_pts (me->sheet, me->old_default);
else
sheet_row_set_default_size_pts (me->sheet, me->old_default);
me->old_default = 0;
return FALSE;
}
static gboolean
cmd_colrow_std_size_redo (GnumericCommand *cmd, WorkbookControl *wbc)
{
CmdColRowStdSize *me = CMD_COLROW_STD_SIZE (cmd);
g_return_val_if_fail (me != NULL, TRUE);
g_return_val_if_fail (me->old_default == 0, TRUE);
if (me->is_cols) {
me->old_default = sheet_col_get_default_size_pts (me->sheet);
sheet_col_set_default_size_pts (me->sheet, me->new_default);
} else {
me->old_default = sheet_row_get_default_size_pts (me->sheet);
sheet_row_set_default_size_pts (me->sheet, me->new_default);
}
return FALSE;
}
static void
cmd_colrow_std_size_destroy (GtkObject *cmd)
{
gnumeric_command_destroy (cmd);
}
gboolean
cmd_colrow_std_size (WorkbookControl *wbc, Sheet *sheet,
gboolean is_cols, double new_default)
{
GtkObject *obj;
CmdColRowStdSize *me;
g_return_val_if_fail (sheet != NULL, TRUE);
obj = gtk_type_new (CMD_COLROW_STD_SIZE_TYPE);
me = CMD_COLROW_STD_SIZE (obj);
/* Store the specs for the object */
me->sheet = sheet;
me->is_cols = is_cols;
me->new_default = new_default;
me->old_default = 0;
me->parent.sheet = sheet;
me->parent.size = 1; /* Changed in initial redo. */
me->parent.cmd_descriptor = is_cols
? g_strdup_printf (_("Setting default width of columns to %.2f"), new_default)
: g_strdup_printf (_("Setting height of rows to %.2f"), new_default);
/* Register the command object */
return command_push_undo (wbc, obj);
}
/******************************************************************/
......
......@@ -65,4 +65,7 @@ gboolean cmd_unmerge_cells (WorkbookControl *wbc, Sheet *sheet,
gboolean cmd_search_replace (WorkbookControl *wbc, Sheet *sheet, SearchReplace *sr);
gboolean cmd_colrow_std_size (WorkbookControl *wbc, Sheet *sheet,
gboolean is_cols, double new_default);
#endif /* GNUMERIC_COMMANDS_H */
......@@ -188,7 +188,55 @@ workbook_cmd_format_column_unhide (GtkWidget *widget, WorkbookControl *wbc)
void
workbook_cmd_format_column_std_width (GtkWidget *widget, WorkbookControl *wbc)
{
/* TODO */
WorkbookControlGUI *wbcg = (WorkbookControlGUI *)wbc;
Sheet *sheet = wb_control_cur_sheet (WORKBOOK_CONTROL (wbcg));
double value = sheet_col_get_default_size_pts (sheet);
/* Scale and round to 3 decimal places */
value *= 1000.;
value = (int)(value + .5);
value /= 1000.;
do {
if (!dialog_get_number (wbcg, "col-width.glade", &value))
return;
if (value > 0.0)
break;
gnumeric_notice (wbcg, GNOME_MESSAGE_BOX_ERROR,
N_("You entered an invalid default column width value. It must be bigger than 0"));
} while (1);
cmd_colrow_std_size (wbc, sheet, TRUE, value);
}
void
workbook_cmd_format_row_std_height (GtkWidget *widget, WorkbookControl *wbc)
{
WorkbookControlGUI *wbcg = (WorkbookControlGUI *)wbc;
Sheet *sheet = wb_control_cur_sheet (WORKBOOK_CONTROL (wbcg));
double value = sheet_row_get_default_size_pts (sheet);
/* Scale and round to 3 decimal places */
value *= 1000.;
value = (int)(value + .5);
value /= 1000.;
do {
if (!dialog_get_number (wbcg, "row-height.glade", &value))
return;
if (value > 0.0)
break;
gnumeric_notice (wbcg, GNOME_MESSAGE_BOX_ERROR,
N_("You entered an invalid default row height value. It must be bigger than 0"));
} while (1);
cmd_colrow_std_size (wbc, sheet, FALSE, value);
}
void
......@@ -204,10 +252,3 @@ workbook_cmd_format_row_unhide (GtkWidget *widget, WorkbookControl *wbc)
cmd_hide_selection_colrow (wbc, wb_control_cur_sheet (wbc),
FALSE, TRUE);
}
void
workbook_cmd_format_row_std_height (GtkWidget *widget, WorkbookControl *wbc)
{
/* TODO */
}
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