Commit d00c0689 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg
Browse files

rethink this. (gnumeric_expr_entry_rangesel_start) : improve parser. Still

2001-11-10  Jody Goldberg <jgoldberg@home.com>

	* gnumeric-expr-entry.c (gnumeric_expr_entry_rangesel_meaningful) :
	  rethink this.
	(gnumeric_expr_entry_rangesel_start) : improve parser.  Still needs
          more work.
2001-11-10  Jody Goldberg <jgoldberg@home.com>

	* src/workbook-control-gui.c (workbook_menu_format_column) :
	  make col menu consistent with row menu.
	* src/GNOME_Gnumeric.xml : ditto.

2001-11-10  Jody Goldberg <jgoldberg@home.com>

	* src/item-cursor.c (item_cursor_draw) : make block cursors more
	  visually appealing.

	* src/workbook-control-gui.c (sheet_action_add_sheet) : restore the
	  focus to the current sheet so that the new sheet does not get the
	  key events.

	* src/workbook-edit.c (wbcg_editing_expr) : delete.
parent b25460de
2001-11-10 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (workbook_menu_format_column) :
make col menu consistent with row menu.
* src/GNOME_Gnumeric.xml : ditto.
2001-11-10 Jody Goldberg <jgoldberg@home.com>
* src/item-cursor.c (item_cursor_draw) : make block cursors more
visually appealing.
* src/workbook-control-gui.c (sheet_action_add_sheet) : restore the
focus to the current sheet so that the new sheet does not get the
key events.
* src/workbook-edit.c (wbcg_editing_expr) : delete.
2001-11-09 Jody Goldberg <jgoldberg@home.com>
http://bugzilla.gnome.org/show_bug.cgi?id=62131
......
2001-11-10 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (workbook_menu_format_column) :
make col menu consistent with row menu.
* src/GNOME_Gnumeric.xml : ditto.
2001-11-10 Jody Goldberg <jgoldberg@home.com>
* src/item-cursor.c (item_cursor_draw) : make block cursors more
visually appealing.
* src/workbook-control-gui.c (sheet_action_add_sheet) : restore the
focus to the current sheet so that the new sheet does not get the
key events.
* src/workbook-edit.c (wbcg_editing_expr) : delete.
2001-11-09 Jody Goldberg <jgoldberg@home.com>
http://bugzilla.gnome.org/show_bug.cgi?id=62131
......
2001-11-10 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (workbook_menu_format_column) :
make col menu consistent with row menu.
* src/GNOME_Gnumeric.xml : ditto.
2001-11-10 Jody Goldberg <jgoldberg@home.com>
* src/item-cursor.c (item_cursor_draw) : make block cursors more
visually appealing.
* src/workbook-control-gui.c (sheet_action_add_sheet) : restore the
focus to the current sheet so that the new sheet does not get the
key events.
* src/workbook-edit.c (wbcg_editing_expr) : delete.
2001-11-09 Jody Goldberg <jgoldberg@home.com>
http://bugzilla.gnome.org/show_bug.cgi?id=62131
......
2001-11-10 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (workbook_menu_format_column) :
make col menu consistent with row menu.
* src/GNOME_Gnumeric.xml : ditto.
2001-11-10 Jody Goldberg <jgoldberg@home.com>
* src/item-cursor.c (item_cursor_draw) : make block cursors more
visually appealing.
* src/workbook-control-gui.c (sheet_action_add_sheet) : restore the
focus to the current sheet so that the new sheet does not get the
key events.
* src/workbook-edit.c (wbcg_editing_expr) : delete.
2001-11-09 Jody Goldberg <jgoldberg@home.com>
http://bugzilla.gnome.org/show_bug.cgi?id=62131
......
......@@ -369,15 +369,15 @@
accel="*Control*1"/>
<submenu _label="C_olumn">
<menuitem name="AutoFit" verb="ColumnAutoSize"
_label="_Auto fit selection"
_tip="Ensure columns are just wide enough to display content" />
<menuitem name="Size" verb="ColumnSize"
pixtype="stock" pixname="Gnumeric_ColumnSize"
_label="_Width..."
_tip="Change width of the selected columns" />
<menuitem name="AutoFit" verb="ColumnAutoSize"
_label="_Auto fit selection"
_tip="Ensure columns are just wide enough to display content" />
<menuitem name="Hide" verb="ColumnHide"
pixtype="stock" pixname="Gnumeric_ColumnHide"
_label="_Hide"
......
......@@ -300,8 +300,7 @@ item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
case ITEM_CURSOR_BLOCK:
draw_center = TRUE;
draw_thick = 1;
draw_external = TRUE;
draw_thick = 3;
break;
case ITEM_CURSOR_SELECTION:
......
2001-11-10 Jody Goldberg <jgoldberg@home.com>
* gnumeric-expr-entry.c (gnumeric_expr_entry_rangesel_meaningful) :
rethink this.
(gnumeric_expr_entry_rangesel_start) : improve parser. Still needs
more work.
2001-11-09 Jody Goldberg <jgoldberg@home.com>
* widget-font-selector.c (cb_get_cell_style) : fix style ref leak.
......
......@@ -151,12 +151,29 @@ update_rangesel_text (GnumericExprEntry *expr_entry)
g_free (text);
}
static gboolean
split_char_p (unsigned char c)
{
switch (c) {
case ',': case '=':
case '(': case '<': case '>':
case '+': case '-': case '*': case '/':
case '^': case '&': case '%': case '!':
return TRUE;
default :
return FALSE;
}
}
/**
* gnumeric_expr_entry_rangesel_start
* @expr_entry: a #GnumericExprEntry
*
* Look at the current selection to see how much of it needs to be changed when
* selecting a range.
*
* NOTE : This routine is damn ugly. I do not like it one bit.
* There must be a cleaner way to do this.
**/
void
gnumeric_expr_entry_rangesel_start (GnumericExprEntry *ee)
......@@ -182,6 +199,13 @@ gnumeric_expr_entry_rangesel_start (GnumericExprEntry *ee)
/* This makes addresses use same coord system as absolute */
pos.col = pos.row = 0;
/* is the cursor in a sheet name ? Do a quick ugly search */
end = text + start;
while (end[0] != '\0' && !split_char_p (end[0]))
end++;
if (end[0] == '!')
start = end - text + 1;
loop :
end = cellref_get (&ref1, text+start, &pos);
if (end == NULL && start > 0 &&
......@@ -193,6 +217,16 @@ gnumeric_expr_entry_rangesel_start (GnumericExprEntry *ee)
if (end == NULL)
return;
/* search the start of the reference, match $AA$1 rather than A$1 */
for (; start > 0 ; start--) {
CellRef tmp;
char const *tmp_end = cellref_get (&tmp, text+start-1, &pos);
if (tmp_end == NULL)
break;
end = tmp_end;
ref1 = tmp;
}
/* This is the first cell */
if (*end == ':') {
char const *end2 = cellref_get (&ref2, end+1, &pos);
......@@ -231,11 +265,13 @@ gnumeric_expr_entry_rangesel_start (GnumericExprEntry *ee)
start -= 2;
goto loop2;
}
/* TODO build up the unquoted name */
} else {
while (start > 0 &&
isalnum (*((unsigned char *)(text + start -1))))
start--;
}
/* TODO lookup the sheet */
rs->text_start = start;
}
}
......@@ -645,7 +681,6 @@ gnumeric_expr_entry_set_absolute (GnumericExprEntry *expr_entry)
gnumeric_expr_entry_set_flags (expr_entry, flags, flags);
}
/**
* gnumeric_expr_entry_rangesel_meaningful
* @expr_entry: a #GnumericExprEntry
......@@ -671,25 +706,23 @@ gboolean
gnumeric_expr_entry_rangesel_meaningful (GnumericExprEntry *ee)
{
int cursor_pos;
char const *text;
g_return_val_if_fail (IS_GNUMERIC_EXPR_ENTRY (ee), FALSE);
cursor_pos = GTK_EDITABLE (ee)->current_pos;
text = gtk_entry_get_text (GTK_ENTRY (ee));
if (NULL == gnumeric_char_start_expr_p (GTK_ENTRY (ee)->text_mb) ||
cursor_pos <= 0)
/* We need to be editing an expression */
if (!wbcg_edit_has_guru (ee->wbcg) &&
gnumeric_char_start_expr_p (text) == NULL)
return FALSE;
switch (GTK_ENTRY (ee)->text [cursor_pos-1]){
case ',': case '=':
case '(': case '<': case '>':
case '+': case '-': case '*': case '/':
case '^': case '&': case '%': case '!':
gnumeric_expr_entry_rangesel_start (ee);
if (ee->rangesel.text_end != ee->rangesel.text_start)
return TRUE;
default :
return FALSE;
};
cursor_pos = gtk_editable_get_position (GTK_EDITABLE (ee));
return (cursor_pos > 0) && split_char_p (text [cursor_pos-1]);
}
/**
......
......@@ -208,13 +208,15 @@ wbcg_rangesel_possible (WorkbookControlGUI const *wbcg)
{
g_return_val_if_fail (IS_WORKBOOK_CONTROL_GUI (wbcg), FALSE);
if (wbcg_edit_entry_redirect_p (wbcg) || NULL != wbcg->rangesel)
/* Already range selecting */
if (wbcg->rangesel != NULL)
return TRUE;
if (!wbcg->editing)
/* Rangesel requires that we be editing somthing */
if (!wbcg->editing && !wbcg_edit_entry_redirect_p (wbcg))
return FALSE;
return wbcg_editing_expr (wbcg);
return gnumeric_expr_entry_rangesel_meaningful (wbcg_get_entry (wbcg));
}
gboolean
......@@ -385,6 +387,7 @@ sheet_action_add_sheet (GtkWidget *widget, SheetControlGUI *scg)
SheetControl *sc = (SheetControl *) scg;
workbook_sheet_add (wb_control_workbook (sc->wbc), sc->sheet, TRUE);
wb_control_gui_focus_cur_sheet (scg->wbcg);
}
static void
......@@ -446,6 +449,7 @@ sheet_action_clone_sheet (GtkWidget *widget, SheetControlGUI *scg)
workbook_sheet_attach (sc->sheet->workbook, new_sheet, sc->sheet);
sheet_set_dirty (new_sheet, TRUE);
wb_control_gui_focus_cur_sheet (scg->wbcg);
}
static void
......@@ -2702,12 +2706,12 @@ static GnomeUIInfo workbook_menu_insert [] = {
/* Format menu */
static GnomeUIInfo workbook_menu_format_column [] = {
GNOMEUIINFO_ITEM_NONE (N_("_Auto fit selection"),
N_("Ensure columns are just wide enough to display content"),
workbook_cmd_format_column_auto_fit),
GNOMEUIINFO_ITEM_STOCK (N_("_Width..."),
N_("Change width of the selected columns"),
sheet_dialog_set_column_width, "Menu_Gnumeric_ColumnSize"),
GNOMEUIINFO_ITEM_NONE (N_("_Auto fit selection"),
N_("Ensure columns are just wide enough to display content"),
workbook_cmd_format_column_auto_fit),
GNOMEUIINFO_ITEM_STOCK (N_("_Hide"),
N_("Hide the selected columns"),
workbook_cmd_format_column_hide, "Menu_Gnumeric_ColumnHide"),
......
......@@ -535,13 +535,6 @@ wbcg_edit_entry_redirect_p (WorkbookControlGUI const *wbcg)
return (wbcg->edit_line.temp_entry != NULL);
}
gboolean
wbcg_editing_expr (WorkbookControlGUI const *wbcg)
{
return (wbcg->edit_line.guru != NULL) ||
gnumeric_expr_entry_rangesel_meaningful (wbcg_get_entry (wbcg));
}
gboolean
wbcg_auto_completing (WorkbookControlGUI const *wbcg)
{
......
......@@ -15,7 +15,6 @@ void wbcg_edit_attach_guru (WorkbookControlGUI *wbcg, GtkWidget *guru);
void wbcg_edit_detach_guru (WorkbookControlGUI *wbcg);
gboolean wbcg_edit_has_guru (WorkbookControlGUI const *wbcg);
gboolean wbcg_edit_entry_redirect_p (WorkbookControlGUI const *wbcg);
gboolean wbcg_editing_expr (WorkbookControlGUI const *wbcg);
gboolean wbcg_auto_completing (WorkbookControlGUI const *wbcg);
void wbcg_auto_complete_destroy (WorkbookControlGUI *wbcg);
char const *wbcg_edit_get_display_text (WorkbookControlGUI *wbcg);
......
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