Commit 3e12961e authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

- Fix some of the problems with the resolution scaling.

- Implement an initial version of paste_cut undo.

2000-02-05  Jody Goldberg <jgoldberg@home.com>

	* src/sheet.[ch] (sheet_row_info_set_{height, width}) : Make static.

	* src/cell.c (cell_calc_dimensions) : The size is already scaled.

	* src/item-bar.c (item_bar_event) : Only scale by the zoom.
	  The item-grid canvas is zoomed by the zoom factor, not by the
	  resolution adjustment.
	(item_bar_start_resize) : Ditto.

	* src/selection.c (sheet_selection_paste) : Use cmd_paste_cut.

	* src/commands.c (cmd_paste_cut) : Implement.

2000-02-04  Jody Goldberg <jgoldberg@home.com>

	* src/widgets/widget-font-selector.c (font_selector_set_points) : new
	  function.
	* src/dialogs/dialog-cell-format.c (fmt_dialog_init_font_page) : Use it.
parent d6fe542a
2000-02-05 Jody Goldberg <jgoldberg@home.com>
* src/sheet.[ch] (sheet_row_info_set_{height, width}) : Make static.
* src/cell.c (cell_calc_dimensions) : The size is already scaled.
* src/item-bar.c (item_bar_event) : Only scale by the zoom.
The item-grid canvas is zoomed by the zoom factor, not by the
resolution adjustment.
(item_bar_start_resize) : Ditto.
* src/selection.c (sheet_selection_paste) : Use cmd_paste_cut.
* src/commands.c (cmd_paste_cut) : Implement.
2000-02-04 Jody Goldberg <jgoldberg@home.com>
* src/widgets/widget-font-selector.c (font_selector_set_points) : new
......
2000-02-05 Jody Goldberg <jgoldberg@home.com>
* src/sheet.[ch] (sheet_row_info_set_{height, width}) : Make static.
* src/cell.c (cell_calc_dimensions) : The size is already scaled.
* src/item-bar.c (item_bar_event) : Only scale by the zoom.
The item-grid canvas is zoomed by the zoom factor, not by the
resolution adjustment.
(item_bar_start_resize) : Ditto.
* src/selection.c (sheet_selection_paste) : Use cmd_paste_cut.
* src/commands.c (cmd_paste_cut) : Implement.
2000-02-04 Jody Goldberg <jgoldberg@home.com>
* src/widgets/widget-font-selector.c (font_selector_set_points) : new
......
......@@ -1190,8 +1190,6 @@ cell_get_span (Cell *cell, int *col1, int *col2)
* @cell: The cell we are working on.
* @style: the style formatting constraints (font, alignments)
* @text: the string contents.
* @cell_w: the cell width
* @cell_h: the cell height
* @h: return value: the height used
* @w: return value: the width used.
*
......@@ -1313,8 +1311,8 @@ cell_calc_dimensions (Cell *cell)
double const scale =
cell->sheet->last_zoom_factor_used *
application_display_dpi_get (FALSE) / 72.;
if ((cell->height * scale) > cell->row->pixels)
sheet_row_set_internal_height (cell->sheet, cell->row, h);
if (cell->height > cell->row->pixels)
sheet_row_set_internal_height (cell->sheet, cell->row, h/scale);
}
mstyle_unref (mstyle);
......
......@@ -54,6 +54,8 @@
* expensive events and should only be done once per command to avoid
* duplicating work.
*
* FIXME: Filter the list of commands when a sheet is deleted.
*
* TODO : Add user preference for undo buffer size limit (# of commands ?)
* TODO : Possibly clear lists on save.
*
......@@ -1379,6 +1381,9 @@ cmd_paste_copy (CommandContext *context,
typedef struct
{
GnumericCommand parent;
ExprRelocateInfo info;
CellRegion *contents;
} CmdPasteCut;
GNUMERIC_MAKE_COMMAND (CmdPasteCut, cmd_paste_cut);
......@@ -1387,10 +1392,27 @@ static gboolean
cmd_paste_cut_undo (GnumericCommand *cmd, CommandContext *context)
{
CmdPasteCut *me = CMD_PASTE_CUT(cmd);
ExprRelocateInfo reverse;
g_return_val_if_fail (me != NULL, TRUE);
g_return_val_if_fail (me->contents != NULL, TRUE);
/* FIXME : Fill in */
reverse.target_sheet = me->info.origin_sheet;
reverse.origin_sheet = me->info.target_sheet;
reverse.origin = me->info.origin;
range_translate (&reverse.origin,
me->info.col_offset,
me->info.row_offset);
reverse.col_offset = -me->info.col_offset;
reverse.row_offset = -me->info.row_offset;
sheet_move_range (context, &reverse);
clipboard_paste_region (context, me->contents, me->info.target_sheet,
me->info.origin.start.col + me->info.col_offset,
me->info.origin.start.row + me->info.row_offset,
PASTE_ALL_TYPES, GDK_CURRENT_TIME);
clipboard_release (me->contents);
me->contents = NULL;
return FALSE;
}
......@@ -1400,17 +1422,28 @@ cmd_paste_cut_redo (GnumericCommand *cmd, CommandContext *context)
CmdPasteCut *me = CMD_PASTE_CUT(cmd);
g_return_val_if_fail (me != NULL, TRUE);
g_return_val_if_fail (me->contents == NULL, TRUE);
me->contents =
clipboard_copy_cell_range (
me->info.target_sheet,
me->info.origin.start.col + me->info.col_offset,
me->info.origin.start.row + me->info.row_offset,
me->info.origin.end.col + me->info.col_offset,
me->info.origin.end.row + me->info.row_offset);
sheet_move_range (context, &me->info);
/* FIXME : Fill in */
return FALSE;
}
static void
cmd_paste_cut_destroy (GtkObject *cmd)
{
#if 0
CmdPasteCut *me = CMD_PASTE_CUT(cmd);
#endif
/* FIXME : Fill in */
if (me->contents) {
clipboard_release (me->contents);
me->contents = NULL;
}
gnumeric_command_destroy (cmd);
}
......@@ -1430,6 +1463,8 @@ cmd_paste_cut (CommandContext *context, ExprRelocateInfo const * const info)
me = CMD_PASTE_CUT (obj);
/* Store the specs for the object */
me->info = *info;
me->contents = NULL;
me->parent.cmd_descriptor = descriptor;
......@@ -1444,8 +1479,9 @@ cmd_paste_cut (CommandContext *context, ExprRelocateInfo const * const info)
* Maybe queue it as 2 different commands, as a clear in one book and
* a paste in the other. This is not symetric though. What happens to the
* cells in the original sheet that now reference the cells in the other.
* When do they reset to the original ? Probably when the clear in the original
* is undone.
* When do they reset to the original ?
*
* Probably when the clear in the original is undone.
*/
return command_push_undo (info->target_sheet->workbook, obj, trouble);
}
......
......@@ -387,8 +387,15 @@ static void
item_bar_start_resize (ItemBar *bar)
{
Sheet const * const sheet = bar->sheet_view->sheet;
double const res = application_display_dpi_get (bar->orientation == GTK_ORIENTATION_VERTICAL);
double const zoom = sheet->last_zoom_factor_used * res / 72.;
#if 0
/*
* handle the zoom from the item-grid canvas, the resolution scaling is
* handled elsewhere
*/
double const res = application_display_dpi_get (bar->orientation ==
GTK_ORIENTATION_VERTICAL);
#endif
double const zoom = sheet->last_zoom_factor_used; /* * res / 72.; */
GnumericSheet const * const gsheet = GNUMERIC_SHEET (bar->sheet_view->sheet_view);
GnomeCanvas const * const canvas = GNOME_CANVAS (gsheet);
GnomeCanvasGroup * const group = GNOME_CANVAS_GROUP (canvas->root);
......@@ -520,8 +527,14 @@ item_bar_event (GnomeCanvasItem *item, GdkEvent *e)
Sheet * const sheet = item_bar->sheet_view->sheet;
const gboolean resizing = ITEM_BAR_RESIZING (item_bar);
const gboolean is_vertical = (item_bar->orientation == GTK_ORIENTATION_VERTICAL);
#if 0
/*
* handle the zoom from the item-grid canvas, the resolution scaling is
* handled elsewhere
*/
double const res = application_display_dpi_get (is_vertical);
double const zoom = sheet->last_zoom_factor_used * res / 72.;
#endif
double const zoom = sheet->last_zoom_factor_used; /* * res / 72.; */
int pos, start, element;
/* NOTE :
......
......@@ -14,6 +14,7 @@
#include "ranges.h"
#include "application.h"
#include "workbook.h"
#include "commands.h"
#include "gnumeric-util.h"
/*
......@@ -783,7 +784,7 @@ sheet_selection_paste (CommandContext *context, Sheet *sheet,
rinfo.origin_sheet = src_sheet;
rinfo.target_sheet = sheet;
sheet_move_range (context, &rinfo);
cmd_paste_cut (context, &rinfo);
sheet_selection_move (&rinfo);
application_clipboard_clear ();
} else {
......
......@@ -636,7 +636,7 @@ sheet_get_extent (Sheet const *sheet)
return r;
}
void
static void
sheet_row_info_set_height (Sheet *sheet, ColRowInfo *ri, int height, gboolean height_set_by_user)
{
g_return_if_fail (sheet != NULL);
......@@ -972,7 +972,7 @@ sheet_recompute_spans_for_col (Sheet *sheet, int col)
g_list_free (dat.cells);
}
void
static void
sheet_col_info_set_width (Sheet *sheet, ColRowInfo *ci, int width)
{
g_return_if_fail (sheet != NULL);
......
......@@ -246,8 +246,6 @@ double sheet_col_get_unit_distance (Sheet const *sheet, int from_col, int
/* Sets the width/height of a column row in terms of pixels */
void sheet_col_set_width (Sheet *sheet,
int col, int width);
void sheet_col_info_set_width (Sheet *sheet,
ColRowInfo *ci, int width);
void sheet_col_set_width_units (Sheet *sheet, int col, double width,
gboolean set_by_user);
void sheet_col_set_internal_width (Sheet *sheet, ColRowInfo *ci,
......@@ -258,9 +256,6 @@ void sheet_row_set_height (Sheet *sheet,
gboolean height_set_by_user);
void sheet_row_set_height_units (Sheet *sheet, int row, double height,
gboolean height_set_by_user);
void sheet_row_info_set_height (Sheet *sheet,
ColRowInfo *ri, int height,
gboolean set_by_user);
void sheet_row_set_internal_height (Sheet *sheet, ColRowInfo *ri, double height);
int sheet_col_size_fit (Sheet *sheet, int col);
......
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