Commit d31d1eaf authored by Miguel de Icaza's avatar Miguel de Icaza Committed by Arturo Espinosa

Add unary '+'

1998-09-05  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* src/parser.y: Add unary '+'

	* src/gnumeric-sheet.c: Add keybinding for Control-Enter which
	fills the selection with the current text.

	* src/sheet.c (sheet_set_text): New function: sets the contents of
	an arbitrary cell to the text as if it were typed by the user.
	(sheet_fill_selection_with): Fill the selection with a string.
parent 76e414be
1998-09-05 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/parser.y: Add unary '+'
* src/gnumeric-sheet.c: Add keybinding for Control-Enter which
fills the selection with the current text.
* src/sheet.c (sheet_set_text): New function: sets the contents of
an arbitrary cell to the text as if it were typed by the user.
(sheet_fill_selection_with): Fill the selection with a string.
1998-09-04 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/gnumeric-sheet.c (gnumeric_sheet_key): Fix the way the
......
1998-09-05 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/parser.y: Add unary '+'
* src/gnumeric-sheet.c: Add keybinding for Control-Enter which
fills the selection with the current text.
* src/sheet.c (sheet_set_text): New function: sets the contents of
an arbitrary cell to the text as if it were typed by the user.
(sheet_fill_selection_with): Fill the selection with a string.
1998-09-04 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/gnumeric-sheet.c (gnumeric_sheet_key): Fix the way the
......
1998-09-05 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/parser.y: Add unary '+'
* src/gnumeric-sheet.c: Add keybinding for Control-Enter which
fills the selection with the current text.
* src/sheet.c (sheet_set_text): New function: sets the contents of
an arbitrary cell to the text as if it were typed by the user.
(sheet_fill_selection_with): Fill the selection with a string.
1998-09-04 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/gnumeric-sheet.c (gnumeric_sheet_key): Fix the way the
......
1998-09-05 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/parser.y: Add unary '+'
* src/gnumeric-sheet.c: Add keybinding for Control-Enter which
fills the selection with the current text.
* src/sheet.c (sheet_set_text): New function: sets the contents of
an arbitrary cell to the text as if it were typed by the user.
(sheet_fill_selection_with): Fill the selection with a string.
1998-09-04 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/gnumeric-sheet.c (gnumeric_sheet_key): Fix the way the
......
......@@ -36,12 +36,6 @@ Automatic completion of names is done per column (looked backwards)
Alt-down arrow pops up a list of available choices for the autofill
Insert blank cells
Inser columns
Insert rows
Copy cells
copy characters withing a cell
* FORMULAS:
Operators, cell references, values, worsheet functions,
......
<section>Copying and moving cells</section>
<sect1><title>Copying and moving cells</title>
There are two ways of moving and copying cells in Gnumeric:
......@@ -16,6 +16,28 @@ control key down will perform a move.
If you use the right button for performing the drag, a menu with the
possible options appears when you release it.
</sect1>
<sect1>
<title>Editing cells using hte selection</title>
<para>
There are various ways of using the selection to ease the
edition of the cells in the spreadhsheet.
</para>
<para>
For instance, given a selection of cells (contiguous, or
non-contiguous), data can be entered. THe enter key will accept
the data and move the cursor to the next cell in the selection
down the selection. The tab on the other hand key will move the
cursor to the rightmost cell (or it will scroll if you have
reached the edge of the selection).
</para>
<para>
Control-Enter does the inverser of Enter (it moves to the
previous cell in the selection, moving towards the top), while
control-tab moves the cursor to the left.
</para>
......@@ -36,12 +36,6 @@ Automatic completion of names is done per column (looked backwards)
Alt-down arrow pops up a list of available choices for the autofill
Insert blank cells
Inser columns
Insert rows
Copy cells
copy characters withing a cell
* FORMULAS:
Operators, cell references, values, worsheet functions,
......
......@@ -157,12 +157,14 @@ cell_set_rendered_text (Cell *cell, char *rendered_text)
void
cell_render_value (Cell *cell)
{
char *color_name;
char *str;
g_return_if_fail (cell != NULL);
g_return_if_fail (cell->value != NULL);
str = format_value (cell->style->format, cell->value, NULL);
cell_set_rendered_text (cell, str);
g_free (str);
}
......
......@@ -610,11 +610,35 @@ gnumeric_sheet_key (GtkWidget *widget, GdkEventKey *event)
case GDK_KP_Delete:
case GDK_Delete:
sheet_selection_clear (gsheet->sheet_view->sheet);
sheet_selection_clear (sheet);
break;
case GDK_Tab:
case GDK_Return:
if ((event->state & GDK_CONTROL_MASK) != 0){
if (gsheet->item_editor){
Cell *cell;
sheet_accept_pending_output (sheet);
cell = sheet_cell_get (sheet,
sheet->cursor_col,
sheet->cursor_row);
/* I am assuming sheet_accept_pending_output
* will always create the cell with the given
* input (based on the fact that we had an
* gsheet->item_editor when we entered this
* part of the code
*/
g_return_val_if_fail (cell != NULL, 1);
g_return_val_if_fail (cell->entered_text != NULL, 1);
sheet_fill_selection_with (
sheet, cell->entered_text->str);
}
return 1;
}
/* fall down */
case GDK_Tab:
{
int col, row;
int walking_selection;
......
......@@ -610,11 +610,35 @@ gnumeric_sheet_key (GtkWidget *widget, GdkEventKey *event)
case GDK_KP_Delete:
case GDK_Delete:
sheet_selection_clear (gsheet->sheet_view->sheet);
sheet_selection_clear (sheet);
break;
case GDK_Tab:
case GDK_Return:
if ((event->state & GDK_CONTROL_MASK) != 0){
if (gsheet->item_editor){
Cell *cell;
sheet_accept_pending_output (sheet);
cell = sheet_cell_get (sheet,
sheet->cursor_col,
sheet->cursor_row);
/* I am assuming sheet_accept_pending_output
* will always create the cell with the given
* input (based on the fact that we had an
* gsheet->item_editor when we entered this
* part of the code
*/
g_return_val_if_fail (cell != NULL, 1);
g_return_val_if_fail (cell->entered_text != NULL, 1);
sheet_fill_selection_with (
sheet, cell->entered_text->str);
}
return 1;
}
/* fall down */
case GDK_Tab:
{
int col, row;
int walking_selection;
......
......@@ -70,7 +70,7 @@ static int yyerror (char *s);
%left '<' '>' '=' GTE LTE NE
%left '-' '+' '&'
%left '*' '/'
%left NEG
%left NEG PLUS
%left '!'
%right '^'
......@@ -179,6 +179,11 @@ exp: NUMBER { $$ = $1 }
$$->oper = OP_NEG;
$$->u.value = $2;
}
| '+' exp %prec PLUS {
$$ = $2;
}
| exp '&' exp {
$$ = p_new (ExprTree);
$$->ref_count = 1;
......
......@@ -580,18 +580,14 @@ sheet_get_selection_name (Sheet *sheet)
}
void
sheet_set_current_value (Sheet *sheet)
sheet_set_text (Sheet *sheet, int col, int row, char *str)
{
GList *l;
Cell *cell;
int col, row;
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
col = sheet->cursor_col;
row = sheet->cursor_row;
cell = sheet_cell_get (sheet, col, row);
if (!cell)
......@@ -606,6 +602,19 @@ sheet_set_current_value (Sheet *sheet)
}
workbook_recalc (sheet->workbook);
}
void
sheet_set_current_value (Sheet *sheet)
{
char *str;
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
str = gtk_entry_get_text (GTK_ENTRY (sheet->workbook->ea_input));
sheet_set_text (sheet, sheet->cursor_col, sheet->cursor_row, str);
}
static void
......@@ -2769,3 +2778,21 @@ sheet_cursor_set (Sheet *sheet, int start_col, int start_row, int end_col, int e
}
}
void
sheet_fill_selection_with (Sheet *sheet, char *str)
{
GList *l;
int col, row;
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
g_return_if_fail (str != NULL);
for (l = sheet->selections; l; l = l->next){
SheetSelection *ss = l->data;
for (col = ss->start_col; col <= ss->end_col; col++)
for (row = ss->start_row; row <= ss->end_row; row++)
sheet_set_text (sheet, col, row, str);
}
}
......@@ -163,6 +163,8 @@ int sheet_selection_is_cell_selected (Sheet *sheet, int col, int row);
gboolean sheet_verify_selection_simple (Sheet *sheet, char *command_name);
/* Cell management */
void sheet_set_text (Sheet *sheet, int col, int row,
char *str);
Cell *sheet_cell_new (Sheet *sheet, int col, int row);
void sheet_cell_add (Sheet *sheet, Cell *cell,
int col, int row);
......@@ -264,6 +266,11 @@ void sheet_load_cell_val (Sheet *sheet);
void sheet_selection_col_extend_to (Sheet *sheet, int col);
void sheet_selection_row_extend_to (Sheet *sheet, int row);
/*
* Callback routines.
*/
void sheet_fill_selection_with (Sheet *sheet, char *text);
/*
* Workbook
*/
......
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