Commit 4c82ff1c authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

- undo works undor bonobo now.

- format toolbar looks better when vertical.
- More commands dummied up for undo.

2000-01-09  Jody Goldberg <jgoldberg@home.com>

	* src/commands.c (cmd_insert_cols) : Be kinder to translators.
	(cmd_insert_rows) : Ditto.
	(cmd_rename_sheet_{undo,redo,destroy}) : Implement.
	(cmd_rename_sheet) : Implement.
	(cmd_set_date_time_{undo,redo,destroy}) : Implement.
	(cmd_set_date_time) : Implement.
	(cmd_resize_row_col_{undo,redo,destroy}) : Implement.
	(cmd_resize_row_col) : Implement.

	* src/workbook.c (insert_at_cursor) : Delete.
	(insert_current_time_cmd) : Use cmd_set_date_time.
	(insert_current_date_cmd) : Ditto.
	(sheet_label_text_changed_signal) : Use cmd_rename_sheet.
	(sheet_action_rename_sheet) : Ditto.

	* src/corba-workbook.c (Workbook_sheet_rename) : Use cmd_rename_sheet.
	* src/workbook-cmd-format.c (workbook_cmd_format_sheet_change_name) : Ditto.
	(workbook_format_toolbar_orient) : New function to hide font selector
	  when vertical.
	(workbook_create_format_toolbar) : Connect to workbook_format_toolbar_orient.

	* src/workbook-view.c (workbook_view_set_undo_redo_state) : Enable
	  Bonobo version.
	(change_menu_label) : Ditto.
	(workbook_view_set_paste_special_state) : Ditto.
parent 174df90b
......@@ -2,15 +2,29 @@
* src/commands.c (cmd_insert_cols) : Be kinder to translators.
(cmd_insert_rows) : Ditto.
(cmd_rename_sheet_{undo,redo,destroy}) : Implement.
(cmd_rename_sheet) : Implement.
(cmd_set_date_time_{undo,redo,destroy}) : Implement.
(cmd_set_date_time) : Implement.
(cmd_resize_row_col_{undo,redo,destroy}) : Implement.
(cmd_resize_row_col) : Implement.
* src/workbook.c (sheet_label_text_changed_signal) : Use
cmd_rename_sheet.
(insert_at_cursor) : Delete.
* src/workbook.c (insert_at_cursor) : Delete.
(insert_current_time_cmd) : Use cmd_set_date_time.
(insert_current_date_cmd) : Use cmd_set_date_time.
(insert_current_date_cmd) : Ditto.
(sheet_label_text_changed_signal) : Use cmd_rename_sheet.
(sheet_action_rename_sheet) : Ditto.
* src/corba-workbook.c (Workbook_sheet_rename) : Use cmd_rename_sheet.
* src/workbook-cmd-format.c (workbook_cmd_format_sheet_change_name) : Ditto.
(workbook_format_toolbar_orient) : New function to hide font selector
when vertical.
(workbook_create_format_toolbar) : Connect to workbook_format_toolbar_orient.
* src/workbook-view.c (workbook_view_set_undo_redo_state) : Enable
Bonobo version.
(change_menu_label) : Ditto.
(workbook_view_set_paste_special_state) : Ditto.
2000-01-08 Jody Goldberg <jgoldberg@home.com>
......
......@@ -2,15 +2,29 @@
* src/commands.c (cmd_insert_cols) : Be kinder to translators.
(cmd_insert_rows) : Ditto.
(cmd_rename_sheet_{undo,redo,destroy}) : Implement.
(cmd_rename_sheet) : Implement.
(cmd_set_date_time_{undo,redo,destroy}) : Implement.
(cmd_set_date_time) : Implement.
(cmd_resize_row_col_{undo,redo,destroy}) : Implement.
(cmd_resize_row_col) : Implement.
* src/workbook.c (sheet_label_text_changed_signal) : Use
cmd_rename_sheet.
(insert_at_cursor) : Delete.
* src/workbook.c (insert_at_cursor) : Delete.
(insert_current_time_cmd) : Use cmd_set_date_time.
(insert_current_date_cmd) : Use cmd_set_date_time.
(insert_current_date_cmd) : Ditto.
(sheet_label_text_changed_signal) : Use cmd_rename_sheet.
(sheet_action_rename_sheet) : Ditto.
* src/corba-workbook.c (Workbook_sheet_rename) : Use cmd_rename_sheet.
* src/workbook-cmd-format.c (workbook_cmd_format_sheet_change_name) : Ditto.
(workbook_format_toolbar_orient) : New function to hide font selector
when vertical.
(workbook_create_format_toolbar) : Connect to workbook_format_toolbar_orient.
* src/workbook-view.c (workbook_view_set_undo_redo_state) : Enable
Bonobo version.
(change_menu_label) : Ditto.
(workbook_view_set_paste_special_state) : Ditto.
2000-01-08 Jody Goldberg <jgoldberg@home.com>
......
......@@ -35,13 +35,7 @@ Gnumeric Spread Sheet task list
* The mouse can select a range as the current argument while editing a
formula without changing to a different cell.
* We do not support selecting a range on a different sheet.
* Expressions
* Implicit iteration. For an array expression that returns scalar results
which takes a range as a scalar argument, apply the expression to each element
of the input range.
* Support selecting a range on a different sheet.
* Implement Even More Functions
......@@ -204,10 +198,13 @@ Gnumeric Spread Sheet task list
** Notebook:
Clicking on it chooses it
Double clicking changes the name
Clicking on it chooses it (DONE)
Double clicking changes the name (DONE)
Right clicking gets:
insert
insert (DONE)
delete (DONE)
rename (DONE)
reorder/copy
- Decrease flicker when paging between sheets.
- Enable capability to select multiple sheets.
......@@ -247,20 +244,66 @@ Office 2000 and 'explorer' compatibility.
* Rendering
* Update the contents of the edit box at the top of the sheet
when the contents of the current cell are changed (ie expr is invalidated)
* Sort out the cell span stuff
* Have a 'merged cell' structure that can be overridden
* have a 'user-set' feature for 'merge cells'
* Calculation
* Rework 'Name' dependencies so we can re-express names.
* Dependancies for - CELL functions.
* Dependancies for - CELL, INDIRECT functions.
- Sheet objects
* Teach dependencies about implicit intersections
( big speedup (assesed2.xls))
* Rethink 'generation' mechanism. It currently forces all cells to
be recalculated when the value of any of them change.
ie
a1 : sum (b2:c3)
changing b2 bumps the generation of the workbook.
All 4 cells b2,b3,c2,c3 get recalculated even though
only b2 needed it.
Functions taking ranges as arguments are forced to do their own
recalc checking for elements of the range. They cheat and use
the generation to test for recalc. This is wrong! It should be sufficent
to only manually recalc a cell that has its recalc flag set. However,
in order to support that we need mark all cells that directly or indirectly
depend on a cell as requiring recalc when a cell changes.
* Implicit iteration. For an array expression that returns scalar results
which takes a range as a scalar argument, apply the expression to each element
of the input range.
* Drawing
* Rework borders to agregate the lines and draw them after backgrounds
* Undo
* Commands to do
- paste_cut
- paste_copy
- clear
- format
- autofill
- insert array.
* Commands to link in
- Row/Col resize. The current linkage between itembar and sheet is odd.
we seem to set the column size for the sheet several times.
* Commands to fix
- SetText. The current scheme of popping the settext command produced
before entering a non-singleton region is a kludge around to problem
of why the top left cells value is changed in the first place.
* Test Bonobo version.
* Make checks for inserting rows/cols more intelligent in the face of multiple
selections. Currently it just checks the first selected range for
infiniteness we need to check all selected ranges.
* Excel Import
* Localise sheet/workbook Name import,
* Import names even if they arn't referenced.
......
......@@ -348,8 +348,10 @@ static void
cmd_set_text_destroy (GtkObject *cmd)
{
CmdSetText *me = CMD_SET_TEXT(cmd);
if (me->text != NULL)
if (me->text != NULL) {
g_free (me->text);
me->text = NULL;
}
gnumeric_command_destroy (cmd);
}
......@@ -391,7 +393,8 @@ cmd_set_text (CommandContext *context,
g_strdup_printf (_("Typing \"%s%s\" in %s"), text, pad,
cell_name(pos->col, pos->row));
if (*pad) g_free (text);
if (*pad)
g_free (text);
/* Register the command object */
return command_push_undo (sheet->workbook, obj, FALSE);
......@@ -1024,8 +1027,10 @@ cmd_set_date_time_destroy (GtkObject *cmd)
{
CmdSetDateTime *me = CMD_SET_DATE_TIME(cmd);
if (me->contents)
if (me->contents) {
g_free (me->contents);
me->contents = NULL;
}
gnumeric_command_destroy (cmd);
}
......@@ -1063,9 +1068,102 @@ cmd_set_date_time (CommandContext *context, gboolean is_date,
/******************************************************************/
#define CMD_RESIZE_ROW_COL_TYPE (cmd_resize_row_col_get_type ())
#define CMD_RESIZE_ROW_COL(o) (GTK_CHECK_CAST ((o), CMD_RESIZE_ROW_COL_TYPE, CmdResizeRowCol))
typedef struct
{
GnumericCommand parent;
Sheet *sheet;
gboolean is_col;
int index;
double *sizes;
} CmdResizeRowCol;
GNUMERIC_MAKE_COMMAND (CmdResizeRowCol, cmd_resize_row_col);
static gboolean
cmd_resize_row_col_undo (GnumericCommand *cmd, CommandContext *context)
{
CmdResizeRowCol *me = CMD_RESIZE_ROW_COL(cmd);
g_return_val_if_fail (me != NULL, TRUE);
g_return_val_if_fail (me->sizes != NULL, TRUE);
/* restore row/col sizes */
sheet_restore_row_col_sizes (me->sheet, me->is_col, me->index, 1,
me->sizes);
me->sizes = NULL;
return FALSE;
}
static gboolean
cmd_resize_row_col_redo (GnumericCommand *cmd, CommandContext *context)
{
CmdResizeRowCol *me = CMD_RESIZE_ROW_COL(cmd);
g_return_val_if_fail (me != NULL, TRUE);
g_return_val_if_fail (me->sizes == NULL, TRUE);
me->sizes = sheet_save_row_col_sizes (me->sheet, me->is_col,
me->index, 1);
return FALSE;
}
static void
cmd_resize_row_col_destroy (GtkObject *cmd)
{
CmdResizeRowCol *me = CMD_RESIZE_ROW_COL(cmd);
if (me->sizes) {
g_free (me->sizes);
me->sizes = NULL;
}
gnumeric_command_destroy (cmd);
}
gboolean
cmd_resize_row_col (CommandContext *context, gboolean is_col,
Sheet *sheet, int index)
{
GtkObject *obj;
CmdResizeRowCol *me;
gboolean trouble;
g_return_val_if_fail (sheet != NULL, TRUE);
obj = gtk_type_new (CMD_RESIZE_ROW_COL_TYPE);
me = CMD_RESIZE_ROW_COL (obj);
/* Store the specs for the object */
me->sheet = sheet;
me->is_col = is_col;
me->index = index;
me->sizes = NULL;
me->parent.cmd_descriptor = is_col
? g_strdup_printf (_("Setting width of column %s"), col_name(index))
: g_strdup_printf (_("Setting height of row %d"), index+1);
trouble = cmd_resize_row_col_redo (GNUMERIC_COMMAND(me), context);
/* TODO :
* - Patch into manual and auto resizing
* - store the selected sized,
*
* There is something odd about the way row/col resize is handled currently.
* The item-bar sends a signal to all the sheet-views each of which sets
* the size for the sheet.
*/
/* Register the command object */
return command_push_undo (sheet->workbook, obj, trouble);
}
/******************************************************************/
/* TODO : Make a list of commands that should have undo support that dont
* even have stubs
* - Autofill
* - Array formula creation.
* - Row/Col size changes
*/
......@@ -27,6 +27,9 @@ gboolean cmd_delete_cols (CommandContext *context,
gboolean cmd_delete_rows (CommandContext *context,
Sheet *sheet, int start_row, int count);
gboolean cmd_resize_row_col (CommandContext *context, gboolean is_col,
Sheet *sheet, int index);
gboolean cmd_paste_cut (CommandContext *context,
ExprRelocateInfo const * const info);
......
......@@ -339,6 +339,26 @@ disable_focus (GtkWidget *base, void *closure)
GTK_WIDGET_UNSET_FLAGS (base, GTK_CAN_FOCUS);
}
/*
* Some toolbar items are too damn wide to put into the toolbar
* if it is vertical.
*/
static void
workbook_format_toolbar_orient (GtkToolbar *toolbar,
GtkOrientation dir,
gpointer closure)
{
Workbook *wb = closure;
if (dir == GTK_ORIENTATION_HORIZONTAL) {
gtk_widget_show (wb->priv->option_menu);
gtk_widget_show (wb->priv->size_widget);
} else {
gtk_widget_hide (wb->priv->option_menu);
gtk_widget_hide (wb->priv->size_widget);
}
}
GtkWidget *
workbook_create_format_toolbar (Workbook *wb)
{
......@@ -387,6 +407,10 @@ workbook_create_format_toolbar (Workbook *wb)
GTK_TOOLBAR (toolbar), wb->priv->option_menu,
_("Font selector"), NULL, 0);
gtk_signal_connect (
GTK_OBJECT(toolbar), "orientation-changed",
GTK_SIGNAL_FUNC (&workbook_format_toolbar_orient), wb);
/*
* Create the font size control
*/
......
......@@ -24,35 +24,46 @@ workbook_view_set_paste_special_state (Workbook *wb, gboolean enable)
gtk_widget_set_sensitive (
wb->priv->menu_item_paste_special, enable);
#else
/* gnome_ui_handler_menu_set_sensitivity (); */
/* FIXME : How to avoid hard coding the menu name here. */
gnome_ui_handler_menu_set_sensitivity (wb->uih,
"/Edit/Paste Special...", enable);
#endif
}
static void
change_menu_label (GtkWidget *menu_item,
change_menu_label (
#ifndef ENABLE_BONOBO
GtkWidget *menu_item,
#else
Workbook const * const wb,
char const * const path,
#endif
char const * const prefix,
char const * suffix)
{
#ifndef ENABLE_BONOBO
gchar *text;
#ifndef ENABLE_BONOBO
GtkBin *bin = GTK_BIN(menu_item);
GtkLabel *label = GTK_LABEL(bin->child);
g_return_if_fail (label != NULL);
gtk_widget_set_sensitive (menu_item, suffix != NULL);
#else
gnome_ui_handler_menu_set_sensitivity (wb->uih, path, suffix != NULL);
#endif
if (suffix == NULL)
suffix = _("Nothing");
/* Limit the size of the descriptor to 30 characters */
text = g_strdup_printf ("%s : %s", prefix, suffix);
#ifndef ENABLE_BONOBO
gtk_label_set_text (label, text);
g_free (text);
#else
/* gnome_ui_handler_menu_set_sensitivity (); */
gnome_ui_handler_menu_set_label (wb->uih, path, text);
#endif
g_free (text);
}
void
......@@ -65,6 +76,10 @@ workbook_view_set_undo_redo_state (Workbook const * const wb,
#ifndef ENABLE_BONOBO
change_menu_label (wb->priv->menu_item_undo, _("Undo"), undo_suffix);
change_menu_label (wb->priv->menu_item_redo, _("Redo"), redo_suffix);
#else
/* FIXME : How to avoid hard coding the menu name here. */
change_menu_label (wb, "/Edit/Undo", _("Undo"), undo_suffix);
change_menu_label (wb, "/Edit/Redo", _("Redo"), redo_suffix);
#endif
}
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