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

It is amazing the number of times I duplicated this code. I wonder if I

1998-10-13  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* src/utils.c (col_name): It is amazing the number of times I
	duplicated this code.  I wonder if I took prozac by accident.
	This should fix the bug reported by Morten Welinder

1998-10-12  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* src/sheet-view.c (vertical_scroll_event,
	horizontal_scroll_event): Set the top column/row from the
	adjustment as well.

	* src/gnumeric-sheet.c (gnumeric_sheet_set_top_col,
	gnumeric_sheet_set_top_row): Export these functions to improve the
	scrolling behaviour.

1998-10-12  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* src/utils.c (cellref_name): Fixed another of column name
	decoding.  I wonder when I will learn.
parent 70ef85f8
1998-10-13 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (col_name): It is amazing the number of times I
duplicated this code. I wonder if I took prozac by accident.
This should fix the bug reported by Morten Welinder
1998-10-12 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/sheet-view.c (vertical_scroll_event,
horizontal_scroll_event): Set the top column/row from the
adjustment as well.
* src/gnumeric-sheet.c (gnumeric_sheet_set_top_col,
gnumeric_sheet_set_top_row): Export these functions to improve the
scrolling behaviour.
1998-10-12 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (cellref_name): Fixed another of column name
......
1998-10-13 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (col_name): It is amazing the number of times I
duplicated this code. I wonder if I took prozac by accident.
This should fix the bug reported by Morten Welinder
1998-10-12 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/sheet-view.c (vertical_scroll_event,
horizontal_scroll_event): Set the top column/row from the
adjustment as well.
* src/gnumeric-sheet.c (gnumeric_sheet_set_top_col,
gnumeric_sheet_set_top_row): Export these functions to improve the
scrolling behaviour.
1998-10-12 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (cellref_name): Fixed another of column name
......
1998-10-13 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (col_name): It is amazing the number of times I
duplicated this code. I wonder if I took prozac by accident.
This should fix the bug reported by Morten Welinder
1998-10-12 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/sheet-view.c (vertical_scroll_event,
horizontal_scroll_event): Set the top column/row from the
adjustment as well.
* src/gnumeric-sheet.c (gnumeric_sheet_set_top_col,
gnumeric_sheet_set_top_row): Export these functions to improve the
scrolling behaviour.
1998-10-12 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (cellref_name): Fixed another of column name
......
1998-10-13 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (col_name): It is amazing the number of times I
duplicated this code. I wonder if I took prozac by accident.
This should fix the bug reported by Morten Welinder
1998-10-12 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/sheet-view.c (vertical_scroll_event,
horizontal_scroll_event): Set the top column/row from the
adjustment as well.
* src/gnumeric-sheet.c (gnumeric_sheet_set_top_col,
gnumeric_sheet_set_top_row): Export these functions to improve the
scrolling behaviour.
1998-10-12 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (cellref_name): Fixed another of column name
......
......@@ -979,14 +979,19 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet)
} while (pixels < canvas->height);
}
static int
int
gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_top_row)
{
GnomeCanvas *rowc = GNOME_CANVAS_ITEM (gsheet->rowbar)->canvas;
Sheet *sheet = gsheet->sheet_view->sheet;
GnomeCanvas *rowc;
Sheet *sheet;
int row_distance;
int x;
g_return_val_if_fail (gsheet != NULL, 0);
g_return_val_if_fail (new_top_row >= 0 && new_top_row <= SHEET_MAX_ROWS-1, 0);
rowc = GNOME_CANVAS_ITEM (gsheet->rowbar)->canvas;
sheet = gsheet->sheet_view->sheet;
gsheet->top_row = new_top_row;
row_distance = sheet_row_get_distance (sheet, 0, gsheet->top_row);
......@@ -996,14 +1001,20 @@ gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_top_row)
return row_distance;
}
static int
int
gnumeric_sheet_set_top_col (GnumericSheet *gsheet, int new_top_col)
{
GnomeCanvas *colc = GNOME_CANVAS_ITEM (gsheet->colbar)->canvas;
Sheet *sheet = gsheet->sheet_view->sheet;
GnomeCanvas *colc;
Sheet *sheet;
int col_distance;
int y;
g_return_val_if_fail (gsheet != NULL, 0);
g_return_val_if_fail (new_top_col >= 0 && new_top_col <= SHEET_MAX_COLS-1, 0);
colc = GNOME_CANVAS_ITEM (gsheet->colbar)->canvas;
sheet = gsheet->sheet_view->sheet;
gsheet->top_col = new_top_col;
col_distance = sheet_col_get_distance (sheet, 0, gsheet->top_col);
......
......@@ -59,6 +59,8 @@ GtkType gnumeric_sheet_get_type (void);
GtkWidget *gnumeric_sheet_new (SheetView *sheet, ItemBar *colbar, ItemBar *rowbar);
void gnumeric_sheet_set_selection (GnumericSheet *gsheet, SheetSelection *ss);
int gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_top_row);
int gnumeric_sheet_set_top_col (GnumericSheet *gsheet, int new_top_col);
void gnumeric_sheet_cursor_set (GnumericSheet *gsheet,
int col, int row);
void gnumeric_sheet_move_cursor (GnumericSheet *gsheet,
......
......@@ -979,14 +979,19 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet)
} while (pixels < canvas->height);
}
static int
int
gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_top_row)
{
GnomeCanvas *rowc = GNOME_CANVAS_ITEM (gsheet->rowbar)->canvas;
Sheet *sheet = gsheet->sheet_view->sheet;
GnomeCanvas *rowc;
Sheet *sheet;
int row_distance;
int x;
g_return_val_if_fail (gsheet != NULL, 0);
g_return_val_if_fail (new_top_row >= 0 && new_top_row <= SHEET_MAX_ROWS-1, 0);
rowc = GNOME_CANVAS_ITEM (gsheet->rowbar)->canvas;
sheet = gsheet->sheet_view->sheet;
gsheet->top_row = new_top_row;
row_distance = sheet_row_get_distance (sheet, 0, gsheet->top_row);
......@@ -996,14 +1001,20 @@ gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_top_row)
return row_distance;
}
static int
int
gnumeric_sheet_set_top_col (GnumericSheet *gsheet, int new_top_col)
{
GnomeCanvas *colc = GNOME_CANVAS_ITEM (gsheet->colbar)->canvas;
Sheet *sheet = gsheet->sheet_view->sheet;
GnomeCanvas *colc;
Sheet *sheet;
int col_distance;
int y;
g_return_val_if_fail (gsheet != NULL, 0);
g_return_val_if_fail (new_top_col >= 0 && new_top_col <= SHEET_MAX_COLS-1, 0);
colc = GNOME_CANVAS_ITEM (gsheet->colbar)->canvas;
sheet = gsheet->sheet_view->sheet;
gsheet->top_col = new_top_col;
col_distance = sheet_col_get_distance (sheet, 0, gsheet->top_col);
......
......@@ -59,6 +59,8 @@ GtkType gnumeric_sheet_get_type (void);
GtkWidget *gnumeric_sheet_new (SheetView *sheet, ItemBar *colbar, ItemBar *rowbar);
void gnumeric_sheet_set_selection (GnumericSheet *gsheet, SheetSelection *ss);
int gnumeric_sheet_set_top_row (GnumericSheet *gsheet, int new_top_row);
int gnumeric_sheet_set_top_col (GnumericSheet *gsheet, int new_top_col);
void gnumeric_sheet_cursor_set (GnumericSheet *gsheet,
int col, int row);
void gnumeric_sheet_move_cursor (GnumericSheet *gsheet,
......
......@@ -97,7 +97,7 @@ cellref_name (CellRef *cell_ref, int eval_col, int eval_row)
col = cell_ref->col;
}
if (col < 'Z'-'A'){
if (col <= 'Z'-'A'){
*p++ = col + 'A';
} else {
int a = col / ('Z'-'A'+1);
......@@ -124,13 +124,13 @@ col_name (int col)
static char buffer [20];
char *p = buffer;
if (col < 'Z'-'A'){
if (col <= 'Z'-'A'){
*p++ = col + 'A';
} else {
int a = col / ('Z'-'A');
int b = col % ('Z'-'A');
int a = col / ('Z'-'A'+1);
int b = col % ('Z'-'A'+1);
*p++ = a + 'A';
*p++ = a + 'A' - 1;
*p++ = b + 'A';
}
*p = 0;
......
......@@ -382,13 +382,20 @@ horizontal_scroll_event (GtkScrollbar *scroll, GdkEvent *event, SheetView *sheet
set_tip_label (sheet_view, _("Column: %s"), GTK_ADJUSTMENT (sheet_view->ha), 1);
position_tooltip (sheet_view, 1);
gtk_widget_show_all (gtk_widget_get_toplevel (sheet_view->tip));
} else if (event->type == GDK_BUTTON_RELEASE){
}
else if (event->type == GDK_BUTTON_RELEASE)
{
GnumericSheet *gsheet = GNUMERIC_SHEET (sheet_view->sheet_view);
SheetSelection *ss = sheet_view->sheet->selections->data;
int col;
gtk_widget_destroy (gtk_widget_get_toplevel (sheet_view->tip));
sheet_view->tip = NULL;
sheet_cursor_move (sheet_view->sheet, GTK_ADJUSTMENT (sheet_view->ha)->value, ss->start_row);
col = GTK_ADJUSTMENT (sheet_view->ha)->value;
gnumeric_sheet_set_top_col (gsheet, col);
sheet_cursor_move (sheet_view->sheet, col, ss->start_row);
}
return FALSE;
......@@ -402,13 +409,20 @@ vertical_scroll_event (GtkScrollbar *scroll, GdkEvent *event, SheetView *sheet_v
set_tip_label (sheet_view, _("Row: %d"), GTK_ADJUSTMENT (sheet_view->va), 0);
position_tooltip (sheet_view, 0);
gtk_widget_show_all (gtk_widget_get_toplevel (sheet_view->tip));
} else if (event->type == GDK_BUTTON_RELEASE){
}
else if (event->type == GDK_BUTTON_RELEASE)
{
GnumericSheet *gsheet = GNUMERIC_SHEET (sheet_view->sheet_view);
SheetSelection *ss = sheet_view->sheet->selections->data;
int row;
gtk_widget_destroy (gtk_widget_get_toplevel (sheet_view->tip));
sheet_view->tip = NULL;
sheet_cursor_move (sheet_view->sheet, ss->start_col, GTK_ADJUSTMENT (sheet_view->va)->value);
row = GTK_ADJUSTMENT (sheet_view->va)->value;
gnumeric_sheet_set_top_row (gsheet, row);
sheet_cursor_move (sheet_view->sheet, ss->start_col, row);
}
return FALSE;
......
......@@ -382,13 +382,20 @@ horizontal_scroll_event (GtkScrollbar *scroll, GdkEvent *event, SheetView *sheet
set_tip_label (sheet_view, _("Column: %s"), GTK_ADJUSTMENT (sheet_view->ha), 1);
position_tooltip (sheet_view, 1);
gtk_widget_show_all (gtk_widget_get_toplevel (sheet_view->tip));
} else if (event->type == GDK_BUTTON_RELEASE){
}
else if (event->type == GDK_BUTTON_RELEASE)
{
GnumericSheet *gsheet = GNUMERIC_SHEET (sheet_view->sheet_view);
SheetSelection *ss = sheet_view->sheet->selections->data;
int col;
gtk_widget_destroy (gtk_widget_get_toplevel (sheet_view->tip));
sheet_view->tip = NULL;
sheet_cursor_move (sheet_view->sheet, GTK_ADJUSTMENT (sheet_view->ha)->value, ss->start_row);
col = GTK_ADJUSTMENT (sheet_view->ha)->value;
gnumeric_sheet_set_top_col (gsheet, col);
sheet_cursor_move (sheet_view->sheet, col, ss->start_row);
}
return FALSE;
......@@ -402,13 +409,20 @@ vertical_scroll_event (GtkScrollbar *scroll, GdkEvent *event, SheetView *sheet_v
set_tip_label (sheet_view, _("Row: %d"), GTK_ADJUSTMENT (sheet_view->va), 0);
position_tooltip (sheet_view, 0);
gtk_widget_show_all (gtk_widget_get_toplevel (sheet_view->tip));
} else if (event->type == GDK_BUTTON_RELEASE){
}
else if (event->type == GDK_BUTTON_RELEASE)
{
GnumericSheet *gsheet = GNUMERIC_SHEET (sheet_view->sheet_view);
SheetSelection *ss = sheet_view->sheet->selections->data;
int row;
gtk_widget_destroy (gtk_widget_get_toplevel (sheet_view->tip));
sheet_view->tip = NULL;
sheet_cursor_move (sheet_view->sheet, ss->start_col, GTK_ADJUSTMENT (sheet_view->va)->value);
row = GTK_ADJUSTMENT (sheet_view->va)->value;
gnumeric_sheet_set_top_row (gsheet, row);
sheet_cursor_move (sheet_view->sheet, ss->start_col, row);
}
return FALSE;
......
......@@ -97,7 +97,7 @@ cellref_name (CellRef *cell_ref, int eval_col, int eval_row)
col = cell_ref->col;
}
if (col < 'Z'-'A'){
if (col <= 'Z'-'A'){
*p++ = col + 'A';
} else {
int a = col / ('Z'-'A'+1);
......@@ -124,13 +124,13 @@ col_name (int col)
static char buffer [20];
char *p = buffer;
if (col < 'Z'-'A'){
if (col <= 'Z'-'A'){
*p++ = col + 'A';
} else {
int a = col / ('Z'-'A');
int b = col % ('Z'-'A');
int a = col / ('Z'-'A'+1);
int b = col % ('Z'-'A'+1);
*p++ = a + 'A';
*p++ = a + 'A' - 1;
*p++ = b + 'A';
}
*p = 0;
......
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