Commit 2264af5a authored by Jody Goldberg's avatar Jody Goldberg

Wed Sep 8 14:11:52 EDT 1999

    1st stab at scrollbars adjusting to visible region.
    Move selection code into a new file, no changes.
    Minor const fixups.
parent 0f10b264
1999-09-08 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_get_span) : Support VALUE_EMPTY.
1999-09-08 Michael Meeks <michael@nuclecu.unam.mx>
* src/sheet-view.c (filenames_dropped, sheet_view_construct): Move
......@@ -29,6 +33,11 @@
* src/workbook.c: changed "_Comments" to "Co_mments" as there is
already "_Content" in the same menu
1999-09-07 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-function-select.c (function_definition_update,
function_categories_fill) : Const.
1999-09-07 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/workbook.c: Remove sample button from the toolbar.
......@@ -85,6 +94,15 @@
* src/cursors.c (create_bitmap_and_mask_from_xpm): Fix bitmap
loading. This code isn't exactly elegant.
1999-09-06 Jody Goldberg <jgoldberg@home.com>
* src/sheet-view.[ch] (sheet_view_scrollbar_config) : Adjust scrollbar
increment. Split out from sheet_view_size_allocate.
* src/gnumeric-sheet.c (gnumeric_sheet_compute_visible_ranges) :
call sheet_view_scrollbar_config, to adjust scrollbar when region
changes.
1999-09-05 Miguel de Icaza <miguel@gnu.org>
* src/print-preview.c (preview_canvas_event): Add an event handler
......
1999-09-08 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_get_span) : Support VALUE_EMPTY.
1999-09-08 Michael Meeks <michael@nuclecu.unam.mx>
* src/sheet-view.c (filenames_dropped, sheet_view_construct): Move
......@@ -29,6 +33,11 @@
* src/workbook.c: changed "_Comments" to "Co_mments" as there is
already "_Content" in the same menu
1999-09-07 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-function-select.c (function_definition_update,
function_categories_fill) : Const.
1999-09-07 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/workbook.c: Remove sample button from the toolbar.
......@@ -85,6 +94,15 @@
* src/cursors.c (create_bitmap_and_mask_from_xpm): Fix bitmap
loading. This code isn't exactly elegant.
1999-09-06 Jody Goldberg <jgoldberg@home.com>
* src/sheet-view.[ch] (sheet_view_scrollbar_config) : Adjust scrollbar
increment. Split out from sheet_view_size_allocate.
* src/gnumeric-sheet.c (gnumeric_sheet_compute_visible_ranges) :
call sheet_view_scrollbar_config, to adjust scrollbar when region
changes.
1999-09-05 Miguel de Icaza <miguel@gnu.org>
* src/print-preview.c (preview_canvas_event): Add an event handler
......
......@@ -119,6 +119,8 @@ GNUMERIC_BASE_SOURCES = \
regression.h \
render-ascii.c \
render-ascii.h \
selection.c \
selection.h \
sheet.c \
sheet.h \
sheet-autofill.c \
......
......@@ -1212,7 +1212,7 @@ cell_get_span (Cell *cell, int *col1, int *col2)
sibling = sheet_cell_get (sheet, pos, row);
if (sibling)
if (!cell_is_blank(sibling))
return;
ci = sheet_col_get_info (sheet, pos);
......@@ -1240,7 +1240,7 @@ cell_get_span (Cell *cell, int *col1, int *col2)
sibling = sheet_cell_get (sheet, pos, row);
if (sibling)
if (!cell_is_blank(sibling))
return;
ci = sheet_col_get_info (sheet, pos);
......@@ -1275,7 +1275,7 @@ cell_get_span (Cell *cell, int *col1, int *col2)
if (*col1 - 1 >= 0){
left_sibling = sheet_cell_get (sheet, *col1 - 1, row);
if (left_sibling)
if (!cell_is_blank(left_sibling))
left_left = 0;
else {
ci = sheet_col_get_info (sheet, *col1 - 1);
......@@ -1291,7 +1291,7 @@ cell_get_span (Cell *cell, int *col1, int *col2)
if (*col2 + 1 < SHEET_MAX_COLS-1){
right_sibling = sheet_cell_get (sheet, *col2 + 1, row);
if (right_sibling)
if (!cell_is_blank(right_sibling))
left_right = 0;
else {
ci = sheet_col_get_info (sheet, *col2 + 1);
......
......@@ -14,6 +14,7 @@
#include "dialogs.h"
#include "format.h"
#include "formats.h"
#include "selection.h"
#include "pattern-selector.h"
#include "widgets/widget-font-selector.h"
......
......@@ -13,6 +13,7 @@
#include "dialogs.h"
#include "cell.h"
#include "expr.h"
#include "selection.h"
#include "utils.h"
typedef struct {
......
......@@ -9,6 +9,7 @@
#include <gnome.h>
#include "gnumeric.h"
#include "gnumeric-util.h"
#include "selection.h"
#include "dialogs.h"
void
......
......@@ -41,7 +41,7 @@ function_categories_fill (SelectorState *selector_state)
gchar *cols [1];
fc = g_list_nth_data (selector_state->cats, i);
cols[0] = fc->name;
cols[0] = (gchar *)fc->name; /* Const cast */
gtk_clist_append (cl, cols);
if (i == selector_state->selected_cat)
......@@ -72,7 +72,7 @@ function_definition_update (SelectorState *selector_state)
gchar *cols [1];
FunctionDefinition *fn = p->data;
cols [0] = fn->name;
cols[0] = (gchar *)fn->name; /* Const cast */
gtk_clist_append (cl, cols);
if (i == selector_state->selected_func)
......
......@@ -9,6 +9,7 @@
#include <gnome.h>
#include "gnumeric.h"
#include "gnumeric-util.h"
#include "selection.h"
#include "dialogs.h"
void
......
......@@ -15,6 +15,7 @@
#include "sheet-object.h"
#include "color.h"
#include "cursors.h"
#include "selection.h"
#include "utils.h"
#undef DEBUG_POSITIONS
......@@ -1115,6 +1116,9 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet)
pixels = cb;
row++;
} while (pixels < height);
/* Update the scrollbar sizes */
sheet_view_scrollbar_config (gsheet->sheet_view);
}
static int
......
......@@ -15,6 +15,7 @@
#include "sheet-object.h"
#include "color.h"
#include "cursors.h"
#include "selection.h"
#include "utils.h"
#undef DEBUG_POSITIONS
......@@ -1115,6 +1116,9 @@ gnumeric_sheet_compute_visible_ranges (GnumericSheet *gsheet)
pixels = cb;
row++;
} while (pixels < height);
/* Update the scrollbar sizes */
sheet_view_scrollbar_config (gsheet->sheet_view);
}
static int
......
......@@ -17,6 +17,7 @@
#include "cursors.h"
#include "sheet-autofill.h"
#include "clipboard.h"
#include "selection.h"
static GnomeCanvasItem *item_cursor_parent_class;
......
......@@ -16,6 +16,7 @@
#include "cursors.h"
#include "gnumeric-util.h"
#include "clipboard.h"
#include "selection.h"
#include "main.h"
static GnomeCanvasItem *item_grid_parent_class;
......
This diff is collapsed.
#ifndef GNUMERIC_SELECTION_H
#define GNUMERIC_SELECTION_H
#include "sheet.h"
/* Selection management */
void sheet_select_all (Sheet *sheet);
int sheet_is_all_selected (Sheet *sheet);
void sheet_selection_append (Sheet *sheet, int col, int row);
void sheet_selection_extend_to (Sheet *sheet, int col, int row);
void sheet_selection_set (Sheet *sheet,
int start_col, int start_row,
int end_col, int end_row);
void sheet_selection_reset (Sheet *sheet);
void sheet_selection_reset_only (Sheet *sheet);
int sheet_selection_equal (SheetSelection *a, SheetSelection *b);
void sheet_selection_append_range (Sheet *sheet,
int base_col, int base_row,
int start_col, int start_row,
int end_col, int end_row);
int sheet_selection_first_range (Sheet *sheet,
int *base_col, int *base_row,
int *start_col, int *start_row,
int *end_col, int *end_row);
void sheet_selection_free (Sheet *sheet);
CellList *sheet_selection_to_list (Sheet *sheet);
char *sheet_selection_to_string (Sheet *sheet, gboolean include_sheet_name_prefix);
/* Operations on the selection */
void sheet_selection_clear (Sheet *sheet);
void sheet_selection_clear_content (Sheet *sheet);
void sheet_selection_clear_comments (Sheet *sheet);
void sheet_selection_clear_formats (Sheet *sheet);
/* Cut/Copy/Paste on the workbook selection */
gboolean sheet_selection_copy (Sheet *sheet);
gboolean sheet_selection_cut (Sheet *sheet);
void sheet_selection_paste (Sheet *sheet,
int dest_col, int dest_row,
int paste_flags, guint32 time32);
int sheet_selection_walk_step (Sheet *sheet,
int forward, int horizontal,
int current_col, int current_row,
int *new_col, int *new_row);
void sheet_selection_extend_horizontal (Sheet *sheet, int count, gboolean jump_to_boundaries);
void sheet_selection_extend_vertical (Sheet *sheet, int count, gboolean jump_to_boundaries);
int sheet_selection_is_cell_selected (Sheet *sheet, int col, int row);
gboolean sheet_verify_selection_simple (Sheet *sheet, const char *command_name);
#endif /* GNUMERIC_SELECTION_H */
......@@ -185,25 +185,41 @@ new_canvas_bar (SheetView *sheet_view, GtkOrientation o, GnomeCanvasItem **itemp
return GNOME_CANVAS (canvas);
}
static void
sheet_view_size_allocate (GtkWidget *widget, GtkAllocation *alloc, SheetView *sheet_view)
/* Manages the scrollbar dimensions and paging parameters. */
void
sheet_view_scrollbar_config (SheetView const *sheet_view)
{
GtkAdjustment *va = GTK_ADJUSTMENT (sheet_view->va);
GtkAdjustment *ha = GTK_ADJUSTMENT (sheet_view->ha);
GnumericSheet *gsheet = GNUMERIC_SHEET (sheet_view->sheet_view);
int last_col = gsheet->last_full_col;
int last_row = gsheet->last_full_row;
Sheet *sheet = sheet_view->sheet;
int const last_col = gsheet->last_full_col;
int const last_row = gsheet->last_full_row;
va->upper = MAX (last_row, sheet_view->sheet->max_row_used);
va->upper = MAX (MAX (last_row,
sheet_view->sheet->max_row_used),
sheet->cursor_row);
va->page_size = last_row - gsheet->top_row;
va->step_increment = va->page_increment =
va->page_size / 2;
ha->upper = MAX (last_col, sheet_view->sheet->max_col_used);
ha->upper = MAX (MAX (last_col,
sheet_view->sheet->max_col_used),
sheet->cursor_col);
ha->page_size = last_col - gsheet->top_col;
ha->step_increment = ha->page_increment =
ha->page_size / 2;
gtk_adjustment_changed (va);
gtk_adjustment_changed (ha);
}
static void
sheet_view_size_allocate (GtkWidget *widget, GtkAllocation *alloc, SheetView *sheet_view)
{
sheet_view_scrollbar_config (sheet_view);
}
static void
sheet_view_col_selection_changed (ItemBar *item_bar, int column, int modifiers, SheetView *sheet_view)
{
......@@ -557,7 +573,6 @@ sheet_view_construct (SheetView *sheet_view)
GTK_SIGNAL_FUNC (button_select_all), sheet_view);
/* Scroll bars and their adjustments */
/* FIXME : The step_inc, page_inc, and page_size should be related to the page size, not 1 */
sheet_view->va = gtk_adjustment_new (0.0, 0.0, sheet->max_row_used, 1.0, 1.0, 1.0);
sheet_view->ha = gtk_adjustment_new (0.0, 0.0, sheet->max_col_used, 1.0, 1.0, 1.0);
sheet_view->hs = gtk_hscrollbar_new (GTK_ADJUSTMENT (sheet_view->ha));
......
......@@ -73,6 +73,8 @@ void sheet_view_set_header_visibility (SheetView *sheet_view,
gboolean col_headers_visible,
gboolean row_headers_visible);
void sheet_view_scrollbar_config (SheetView const *sheet_view);
typedef struct {
GtkTableClass parent_class;
} SheetViewClass;
......
......@@ -185,25 +185,41 @@ new_canvas_bar (SheetView *sheet_view, GtkOrientation o, GnomeCanvasItem **itemp
return GNOME_CANVAS (canvas);
}
static void
sheet_view_size_allocate (GtkWidget *widget, GtkAllocation *alloc, SheetView *sheet_view)
/* Manages the scrollbar dimensions and paging parameters. */
void
sheet_view_scrollbar_config (SheetView const *sheet_view)
{
GtkAdjustment *va = GTK_ADJUSTMENT (sheet_view->va);
GtkAdjustment *ha = GTK_ADJUSTMENT (sheet_view->ha);
GnumericSheet *gsheet = GNUMERIC_SHEET (sheet_view->sheet_view);
int last_col = gsheet->last_full_col;
int last_row = gsheet->last_full_row;
Sheet *sheet = sheet_view->sheet;
int const last_col = gsheet->last_full_col;
int const last_row = gsheet->last_full_row;
va->upper = MAX (last_row, sheet_view->sheet->max_row_used);
va->upper = MAX (MAX (last_row,
sheet_view->sheet->max_row_used),
sheet->cursor_row);
va->page_size = last_row - gsheet->top_row;
va->step_increment = va->page_increment =
va->page_size / 2;
ha->upper = MAX (last_col, sheet_view->sheet->max_col_used);
ha->upper = MAX (MAX (last_col,
sheet_view->sheet->max_col_used),
sheet->cursor_col);
ha->page_size = last_col - gsheet->top_col;
ha->step_increment = ha->page_increment =
ha->page_size / 2;
gtk_adjustment_changed (va);
gtk_adjustment_changed (ha);
}
static void
sheet_view_size_allocate (GtkWidget *widget, GtkAllocation *alloc, SheetView *sheet_view)
{
sheet_view_scrollbar_config (sheet_view);
}
static void
sheet_view_col_selection_changed (ItemBar *item_bar, int column, int modifiers, SheetView *sheet_view)
{
......@@ -557,7 +573,6 @@ sheet_view_construct (SheetView *sheet_view)
GTK_SIGNAL_FUNC (button_select_all), sheet_view);
/* Scroll bars and their adjustments */
/* FIXME : The step_inc, page_inc, and page_size should be related to the page size, not 1 */
sheet_view->va = gtk_adjustment_new (0.0, 0.0, sheet->max_row_used, 1.0, 1.0, 1.0);
sheet_view->ha = gtk_adjustment_new (0.0, 0.0, sheet->max_col_used, 1.0, 1.0, 1.0);
sheet_view->hs = gtk_hscrollbar_new (GTK_ADJUSTMENT (sheet_view->ha));
......
......@@ -73,6 +73,8 @@ void sheet_view_set_header_visibility (SheetView *sheet_view,
gboolean col_headers_visible,
gboolean row_headers_visible);
void sheet_view_scrollbar_config (SheetView const *sheet_view);
typedef struct {
GtkTableClass parent_class;
} SheetViewClass;
......
This diff is collapsed.
......@@ -29,6 +29,12 @@ typedef struct {
int row;
} ParsePosition;
typedef struct {
int base_col, base_row;
int start_col, start_row;
int end_col, end_row;
} SheetSelection;
#ifdef ENABLE_BONOBO
# include <bonobo/gnome-container.h>
#endif
......@@ -55,12 +61,6 @@ typedef struct {
Style *style;
} StyleRegion;
typedef struct {
int base_col, base_row;
int start_col, start_row;
int end_col, end_row;
} SheetSelection;
typedef enum {
/* Normal editing mode of the Sheet */
SHEET_MODE_SHEET,
......@@ -167,49 +167,6 @@ void sheet_cursor_move (Sheet *sheet, int col, int row,
gboolean clear_selection, gboolean add_dest_to_selection);
void sheet_make_cell_visible (Sheet *sheet, int col, int row);
/* Selection management */
void sheet_select_all (Sheet *sheet);
int sheet_is_all_selected (Sheet *sheet);
void sheet_selection_append (Sheet *sheet, int col, int row);
void sheet_selection_extend_to (Sheet *sheet, int col, int row);
void sheet_selection_set (Sheet *sheet,
int start_col, int start_row,
int end_col, int end_row);
void sheet_selection_reset (Sheet *sheet);
void sheet_selection_reset_only (Sheet *sheet);
int sheet_selection_equal (SheetSelection *a, SheetSelection *b);
void sheet_selection_append_range (Sheet *sheet,
int base_col, int base_row,
int start_col, int start_row,
int end_col, int end_row);
int sheet_selection_first_range (Sheet *sheet,
int *base_col, int *base_row,
int *start_col, int *start_row,
int *end_col, int *end_row);
CellList *sheet_selection_to_list (Sheet *sheet);
char *sheet_selection_to_string (Sheet *sheet, gboolean include_sheet_name_prefix);
/* Operations on the selection */
void sheet_selection_clear (Sheet *sheet);
void sheet_selection_clear_content (Sheet *sheet);
void sheet_selection_clear_comments (Sheet *sheet);
void sheet_selection_clear_formats (Sheet *sheet);
/* Cut/Copy/Paste on the workbook selection */
gboolean sheet_selection_copy (Sheet *sheet);
gboolean sheet_selection_cut (Sheet *sheet);
void sheet_selection_paste (Sheet *sheet,
int dest_col, int dest_row,
int paste_flags, guint32 time32);
int sheet_selection_walk_step (Sheet *sheet,
int forward, int horizontal,
int current_col, int current_row,
int *new_col, int *new_row);
void sheet_selection_extend_horizontal (Sheet *sheet, int count, gboolean jump_to_boundaries);
void sheet_selection_extend_vertical (Sheet *sheet, int count, gboolean jump_to_boundaries);
int sheet_selection_is_cell_selected (Sheet *sheet, int col, int row);
gboolean sheet_verify_selection_simple (Sheet *sheet, const char *command_name);
/* Cell management */
void sheet_set_text (Sheet *sheet, int col, int row,
const char *str);
......@@ -305,6 +262,8 @@ void sheet_compute_visible_ranges (Sheet *sheet);
void sheet_redraw_cell_region (Sheet *sheet,
int start_col, int start_row,
int end_col, int end_row);
void sheet_redraw_cols (Sheet *sheet);
void sheet_redraw_rows (Sheet *sheet);
void sheet_redraw_selection (Sheet *sheet, SheetSelection *ss);
void sheet_redraw_all (Sheet *sheet);
......@@ -340,6 +299,7 @@ void sheet_style_attach (Sheet *sheet,
Style *style);
Sheet *sheet_lookup_by_name (Workbook *wb, const char *name);
void sheet_update_controls (Sheet *sheet);
/*
* Sheet visual editing
*/
......@@ -391,4 +351,3 @@ void sheet_insert_object (Sheet *sheet, char *repoid);
void sheet_corba_setup (Sheet *);
void sheet_corba_shutdown (Sheet *);
#endif /* GNUMERIC_SHEET_H */
......@@ -25,6 +25,7 @@
#include "widgets/widget-editable-label.h"
#include "print-info.h"
#include "ranges.h"
#include "selection.h"
#ifdef ENABLE_BONOBO
#include <bonobo/gnome-persist-file.h>
......
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