[gnumeric] Paste: also paste widths of full columns pasted.



commit 58c0499f19e29e9396825f1834fb1ac5173f605c
Author: Morten Welinder <terra gnome org>
Date:   Mon Apr 23 22:54:32 2018 -0400

    Paste: also paste widths of full columns pasted.
    
    Work in progress.  Undo doesn't work yet.

 src/clipboard.c                    |   45 ++++++++--
 src/clipboard.h                    |   24 ++++--
 src/cmd-edit.c                     |   10 +-
 src/commands.c                     |   12 ++--
 src/dialogs/dialog-paste-special.c |   24 ++++-
 src/dialogs/paste-special.ui       |  166 +++++++++++++++++++-----------------
 src/item-cursor.c                  |    4 +-
 src/selection.c                    |    8 +-
 src/sheet-control-gui.c            |   64 +++++++-------
 9 files changed, 209 insertions(+), 148 deletions(-)
---
diff --git a/src/clipboard.c b/src/clipboard.c
index 5753541..860a261 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -253,10 +253,10 @@ struct paste_cell_data {
  * paste_cell:
  * @target_col:  Column to put the cell into
  * @target_row:  Row to put the cell into.
- * @src:         A #GnmCelCopy with the content to paste
+ * @src:         A #GnmCellCopy with the content to paste
  * @paste_flags: Bit mask that describes the paste options.
  *
- *  Pastes a cell in the spreadsheet.
+ * Pastes a cell in the spreadsheet.
  */
 static void
 paste_cell (int target_col, int target_row,
@@ -417,7 +417,7 @@ range_flip_v (GnmRange *range, Sheet const *sheet, int const *data)
  * the destination if the target is a singleton.  This is a simple interface to
  * paste a region.
  *
- * returns : TRUE if there was a problem.
+ * Returns: %TRUE if there was a problem.
  **/
 gboolean
 clipboard_paste_region (GnmCellRegion const *cr,
@@ -432,6 +432,7 @@ clipboard_paste_region (GnmCellRegion const *cr,
        gboolean has_contents, adjust_merges = TRUE;
        struct paste_cell_data dat;
        GnmRange const *merge_src;
+       gboolean no_flipping, do_col_widths, do_row_heights;
 
        g_return_val_if_fail (pt != NULL, TRUE);
        g_return_val_if_fail (cr != NULL, TRUE);
@@ -632,6 +633,35 @@ clipboard_paste_region (GnmCellRegion const *cr,
                                        paste_object (pt, ptr->data, left, top);
                }
 
+       no_flipping = (pt->paste_flags & (PASTE_FLIP_H | PASTE_FLIP_V | PASTE_TRANSPOSE)) == 0;
+       do_col_widths =
+               no_flipping &&
+               ((pt->paste_flags & PASTE_COLUMN_WIDTHS) ||
+                ((pt->paste_flags & PASTE_COLUMN_WIDTHS_AUTO) &&
+                 cr->origin_sheet &&
+                 src_rows == gnm_sheet_get_max_rows (cr->origin_sheet)));
+       if (do_col_widths) {
+               int i;
+               for (i = 0; i < repeat_horizontal; i++) {
+                       int first = pt->range.start.col + i * src_cols;
+                       colrow_set_states (pt->sheet, TRUE, first, cr->col_state);
+               }
+       }
+
+       do_row_heights =
+               no_flipping &&
+               ((pt->paste_flags & PASTE_ROW_HEIGHTS) ||
+                ((pt->paste_flags & PASTE_ROW_HEIGHTS_AUTO) &&
+                 cr->origin_sheet &&
+                 src_cols == gnm_sheet_get_max_cols (cr->origin_sheet)));
+       if (do_row_heights) {
+               int i;
+               for (i = 0; i < repeat_vertical; i++) {
+                       int first = pt->range.start.row + i * src_rows;
+                       colrow_set_states (pt->sheet, FALSE, first, cr->row_state);
+               }
+       }
+
        if (!(pt->paste_flags & PASTE_NO_RECALC)) {
                if (has_contents) {
                        sheet_region_queue_recalc (pt->sheet, r);
@@ -641,8 +671,6 @@ clipboard_paste_region (GnmCellRegion const *cr,
 
                sheet_range_calc_spans (pt->sheet, r,
                                        (pt->paste_flags & PASTE_FORMATS) ? GNM_SPANCALC_RE_RENDER : 
GNM_SPANCALC_RENDER);
-               if (pt->paste_flags & PASTE_UPDATE_ROW_HEIGHT)
-                       rows_height_update (pt->sheet, &pt->range, FALSE);
                sheet_redraw_all (pt->sheet, FALSE);
        }
 
@@ -745,7 +773,8 @@ cb_clipboard_copy_range_undo (GnmCellRegion *cr, GnmSheetRange *sr,
                                    sr->sheet,
                                    &sr->range,
                                    PASTE_CONTENTS | PASTE_FORMATS |
-                                   PASTE_OBJECTS | PASTE_COMMENTS),
+                                   PASTE_OBJECTS | PASTE_COMMENTS |
+                                   PASTE_COLUMN_WIDTHS | PASTE_ROW_HEIGHTS),
                 cc);
 }
 
@@ -857,7 +886,7 @@ paste_target_init (GnmPasteTarget *pt, Sheet *sheet,
 }
 
 /**
- * gnm_cell_region_new :
+ * gnm_cell_region_new:
  * @origin_sheet: optionally NULL.
  *
  * A convenience routine to create CellRegions and init the flags nicely.
@@ -972,7 +1001,7 @@ cb_invalidate_cellcopy (GnmCellCopy *cc, gconstpointer ignore,
 }
 
 /**
- * cellregion_invalidate_sheet :
+ * cellregion_invalidate_sheet:
  * @cr: #GnmCellRegion
  * @sheet: #Sheet
  *
diff --git a/src/clipboard.h b/src/clipboard.h
index 8cd1158..89fc8ca 100644
--- a/src/clipboard.h
+++ b/src/clipboard.h
@@ -35,20 +35,28 @@ typedef enum {
        /* Internal flag : see cmd_merge_cells_undo for details */
        PASTE_IGNORE_COMMENTS_AT_ORIGIN   = 1 << 13,
 
-       /* Update the row height when pasting? (for large fonts, etc.) */
-       PASTE_UPDATE_ROW_HEIGHT = 1 << 14,
+       // Copy column widths
+       PASTE_COLUMN_WIDTHS = 1 << 14,
+       PASTE_COLUMN_WIDTHS_AUTO = 1 << 15,
+       PASTE_COLUMN_WIDTHS_MASK = (PASTE_COLUMN_WIDTHS | PASTE_COLUMN_WIDTHS_AUTO),
 
-       PASTE_EXPR_LOCAL_RELOCATE = 1 << 15,
+       // Copy row heights
+       PASTE_ROW_HEIGHTS = 1 << 16,
+       PASTE_ROW_HEIGHTS_AUTO = 1 << 17,
+       PASTE_ROW_HEIGHTS_MASK = (PASTE_ROW_HEIGHTS | PASTE_ROW_HEIGHTS_AUTO),
+
+       PASTE_EXPR_LOCAL_RELOCATE = 1 << 18,
 
        /* Avoid flagging dependencies.  */
-       PASTE_NO_RECALC         = 1 << 16,
+       PASTE_NO_RECALC         = 1 << 19,
 
        /* Whether the paste flips or not */
-       PASTE_FLIP_H         = 1 << 17,
-       PASTE_FLIP_V         = 1 << 18,
+       PASTE_FLIP_H         = 1 << 20,
+       PASTE_FLIP_V         = 1 << 21,
 
-       PASTE_ALL_TYPES = (PASTE_CONTENTS | PASTE_FORMATS | PASTE_COMMENTS | PASTE_OBJECTS),
-       PASTE_DEFAULT = PASTE_ALL_TYPES
+       PASTE_ALL_CELL = (PASTE_CONTENTS | PASTE_FORMATS | PASTE_COMMENTS | PASTE_OBJECTS),
+       PASTE_ALL_SHEET = (PASTE_ALL_CELL | PASTE_COLUMN_WIDTHS_AUTO | PASTE_ROW_HEIGHTS_AUTO),
+       PASTE_DEFAULT = PASTE_ALL_SHEET
 } GnmPasteFlags;
 
 #define PASTE_OPER_MASK (PASTE_OPER_ADD | PASTE_OPER_SUB | PASTE_OPER_MULT | PASTE_OPER_DIV)
diff --git a/src/cmd-edit.c b/src/cmd-edit.c
index 48e93da..1fe6a4d 100644
--- a/src/cmd-edit.c
+++ b/src/cmd-edit.c
@@ -86,7 +86,7 @@ sv_select_cur_col (SheetView *sv)
 }
 
 /**
- * sv_select_cur_array :
+ * sv_select_cur_array:
  * @sv: The sheet
  *
  * If the editpos is part of an array clear the selection and select the array.
@@ -135,7 +135,7 @@ cb_collect_deps (GnmDependent *dep, gpointer user)
 }
 
 /**
- * sv_select_cur_depends :
+ * sv_select_cur_depends:
  * @sv: The sheet
  *
  * Select all cells that depend on the expression in the current cell.
@@ -225,7 +225,7 @@ sv_select_cur_depends (SheetView *sv)
 }
 
 /**
- * sv_select_cur_inputs :
+ * sv_select_cur_inputs:
  * @sv: The sheet
  *
  * Select all cells that are direct potential inputs to the
@@ -277,7 +277,7 @@ sv_select_cur_inputs (SheetView *sv)
 }
 
 /**
- * cmd_paste :
+ * cmd_paste:
  *
  * Pastes the current cut buffer, copy buffer, or X selection to
  * the destination sheet range.
@@ -356,7 +356,7 @@ cmd_paste (WorkbookControl *wbc, GnmPasteTarget const *pt)
 }
 
 /**
- * cmd_paste_to_selection :
+ * cmd_paste_to_selection:
  * @dest_sv: The sheet into which things should be pasted
  * @paste_flags: special paste flags (eg transpose)
  *
diff --git a/src/commands.c b/src/commands.c
index 8b57517..a46eeac 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -2726,7 +2726,7 @@ cmd_paste_cut_redo (GnmCommand *cmd, WorkbookControl *wbc)
        if (me->info.origin_sheet != me->info.target_sheet ||
            !range_overlap (&me->info.origin, &tmp)) {
                PasteContent *pc = g_new (PasteContent, 1);
-               paste_target_init (&pc->pt, me->info.target_sheet, &tmp, PASTE_ALL_TYPES);
+               paste_target_init (&pc->pt, me->info.target_sheet, &tmp, PASTE_ALL_SHEET);
                pc->contents = clipboard_copy_range (me->info.target_sheet, &tmp);
                me->paste_contents = g_slist_prepend (me->paste_contents, pc);
        } else {
@@ -2739,7 +2739,7 @@ cmd_paste_cut_redo (GnmCommand *cmd, WorkbookControl *wbc)
 
                        if (!range_overlap (&me->info.origin, r)) {
                                PasteContent *pc = g_new (PasteContent, 1);
-                               paste_target_init (&pc->pt, me->info.target_sheet, r, PASTE_ALL_TYPES);
+                               paste_target_init (&pc->pt, me->info.target_sheet, r, PASTE_ALL_SHEET);
                                pc->contents = clipboard_copy_range (me->info.target_sheet,  r);
                                me->paste_contents = g_slist_prepend (me->paste_contents, pc);
                        }
@@ -2751,7 +2751,7 @@ cmd_paste_cut_redo (GnmCommand *cmd, WorkbookControl *wbc)
        /* rare corner case.  If the origin sheet has been deleted */
        if (!IS_SHEET (me->info.origin_sheet)) {
                GnmPasteTarget pt;
-               paste_target_init (&pt, me->info.target_sheet, &tmp, PASTE_ALL_TYPES);
+               paste_target_init (&pt, me->info.target_sheet, &tmp, PASTE_ALL_SHEET);
                sheet_clear_region (pt.sheet,
                        tmp.start.col, tmp.start.row, tmp.end.col,   tmp.end.row,
                        CLEAR_VALUES | CLEAR_MERGES | CLEAR_NOCHECKARRAY | CLEAR_RECALC_DEPS,
@@ -3002,7 +3002,7 @@ cmd_paste_copy_impl (GnmCommand *cmd, WorkbookControl *wbc,
        contents = clipboard_copy_range (me->dst.sheet, &me->dst.range);
        if (me->has_been_through_cycle)
                me->dst.paste_flags = PASTE_CONTENTS |
-                       (me->dst.paste_flags & PASTE_ALL_TYPES);
+                       (me->dst.paste_flags & PASTE_ALL_SHEET);
        actual_dst = me->dst;
        if (clipboard_paste_region (me->contents, &actual_dst, GO_CMD_CONTEXT (wbc))) {
                /* There was a problem, avoid leaking */
@@ -5190,7 +5190,7 @@ cmd_analysis_tool_undo (GnmCommand *cmd, WorkbookControl *wbc)
                                    CLEAR_RECALC_DEPS | CLEAR_VALUES | CLEAR_MERGES,
                                    GO_CMD_CONTEXT (wbc));
                clipboard_paste_region (me->old_contents,
-                       paste_target_init (&pt, me->dao->sheet, &me->old_range, PASTE_ALL_TYPES),
+                       paste_target_init (&pt, me->dao->sheet, &me->old_range, PASTE_ALL_SHEET),
                        GO_CMD_CONTEXT (wbc));
                cellregion_unref (me->old_contents);
                me->old_contents = NULL;
@@ -5453,7 +5453,7 @@ cmd_merge_data_redo (GnmCommand *cmd, WorkbookControl *wbc)
                colrow_set_states (new_sheet, FALSE, target_range.start.row, state_row);
                sheet_objects_dup (source_sheet, new_sheet, &target_range);
                clipboard_paste_region (merge_contents,
-                       paste_target_init (&pt, new_sheet, &target_range, PASTE_ALL_TYPES),
+                       paste_target_init (&pt, new_sheet, &target_range, PASTE_ALL_SHEET),
                        GO_CMD_CONTEXT (wbc));
        }
        cellregion_unref (merge_contents);
diff --git a/src/dialogs/dialog-paste-special.c b/src/dialogs/dialog-paste-special.c
index bf4fbdc..e84df5e 100644
--- a/src/dialogs/dialog-paste-special.c
+++ b/src/dialogs/dialog-paste-special.c
@@ -28,7 +28,7 @@
 #include <wbc-gtk.h>
 #include <gui-util.h>
 #include <clipboard.h>
-#include <dependent.h>
+#include <selection.h>
 #include <cmd-edit.h>
 
 #include <gtk/gtk.h>
@@ -41,11 +41,11 @@ static char const * const paste_type_group[] = {
        "paste-type-comments",
        NULL
 };
-static struct {
+static const struct {
        gboolean permit_cell_ops;
        int paste_enum;
 } paste_type_group_props[] = {
-       {TRUE, PASTE_ALL_TYPES},
+       {TRUE, PASTE_ALL_CELL},
        {TRUE, PASTE_CONTENTS},
        {TRUE, PASTE_AS_VALUES},
        {FALSE, PASTE_FORMATS},
@@ -59,7 +59,7 @@ static char const * const cell_operation_group[] = {
        "cell-operation-divide",
        NULL
 };
-static struct {
+static const struct {
        int paste_enum;
 } cell_operation_props[] = {
        {0},
@@ -75,7 +75,7 @@ static char const * const region_operation_group[] = {
        "region-operation-flip-v",
        NULL
 };
-static struct {
+static const struct {
        int paste_enum;
 } region_operation_props[] = {
        {0},
@@ -216,6 +216,13 @@ cb_tool_ok_clicked (G_GNUC_UNUSED GtkWidget *button,
            (GTK_TOGGLE_BUTTON (go_gtk_builder_get_widget (state->gui,"dont-change-formulae"))))
                result |= PASTE_EXPR_LOCAL_RELOCATE;
 
+       if (gtk_toggle_button_get_active
+           (GTK_TOGGLE_BUTTON (go_gtk_builder_get_widget (state->gui,"row-heights"))))
+               result |= PASTE_ROW_HEIGHTS;
+       if (gtk_toggle_button_get_active
+           (GTK_TOGGLE_BUTTON (go_gtk_builder_get_widget (state->gui,"column-widths"))))
+               result |= PASTE_COLUMN_WIDTHS;
+
        cmd_paste_to_selection (GNM_WBC (state->wbcg), state->sv, result);
        gtk_widget_destroy (state->dialog);
        return;
@@ -285,6 +292,13 @@ dialog_paste_special (WBCGtk *wbcg)
                                G_CALLBACK (dialog_paste_special_skip_blanks_toggled_cb), state);
        paste_link_set_sensitive (state);
 
+       gtk_toggle_button_set_active
+               (GTK_TOGGLE_BUTTON (go_gtk_builder_get_widget (state->gui,"column-widths")),
+                sv_is_full_colrow_selected (state->sv, TRUE, -1));
+       gtk_toggle_button_set_active
+               (GTK_TOGGLE_BUTTON (go_gtk_builder_get_widget (state->gui,"row-heights")),
+                sv_is_full_colrow_selected (state->sv, FALSE, -1));
+
        gnm_dialog_setup_destroy_handlers (GTK_DIALOG (state->dialog), wbcg,
                                           GNM_DIALOG_DESTROY_SHEET_REMOVED);
 
diff --git a/src/dialogs/paste-special.ui b/src/dialogs/paste-special.ui
index 16ca3ac..086fcc4 100644
--- a/src/dialogs/paste-special.ui
+++ b/src/dialogs/paste-special.ui
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.8"/>
   <object class="GtkDialog" id="paste-special">
     <property name="can_focus">False</property>
     <property name="border_width">5</property>
@@ -24,7 +25,6 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -40,7 +40,6 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
               </object>
               <packing>
@@ -56,7 +55,6 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -72,7 +70,6 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -97,19 +94,18 @@
             <property name="border_width">6</property>
             <property name="row_spacing">6</property>
             <property name="column_spacing">12</property>
+            <property name="column_homogeneous">True</property>
             <child>
               <object class="GtkLabel" id="Paste-Type">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes">&lt;b&gt;Paste type&lt;/b&gt;</property>
                 <property name="use_markup">True</property>
+                <property name="xalign">0</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -120,7 +116,6 @@
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
                 <property name="margin_left">18</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
                 <property name="xalign">0</property>
                 <property name="active">True</property>
@@ -129,8 +124,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">1</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -140,8 +133,8 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Paste the cell contents only, not the 
formatting</property>
                 <property name="margin_left">18</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
                 <property name="xalign">0</property>
                 <property name="draw_indicator">True</property>
@@ -150,8 +143,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">2</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -161,8 +152,8 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Paste the value of expressions rather than 
the expressions themselves</property>
                 <property name="margin_left">18</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
                 <property name="xalign">0</property>
                 <property name="draw_indicator">True</property>
@@ -171,8 +162,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">3</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -182,8 +171,8 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Paste cell formats (number formats, colors, 
borders, etc.) only</property>
                 <property name="margin_left">18</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
                 <property name="xalign">0</property>
                 <property name="draw_indicator">True</property>
@@ -192,8 +181,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">4</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -203,8 +190,8 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Paste cell comments only</property>
                 <property name="margin_left">18</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
                 <property name="xalign">0</property>
                 <property name="draw_indicator">True</property>
@@ -213,43 +200,19 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">5</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
               <object class="GtkLabel" id="label3">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes">&lt;b&gt;Cell operation&lt;/b&gt;</property>
                 <property name="use_markup">True</property>
+                <property name="xalign">0</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
                 <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="skip-blanks">
-                <property name="label" translatable="yes">Skip _Blanks</property>
-                <property name="use_action_appearance">False</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="margin_top">6</property>
-                <property name="use_action_appearance">False</property>
-                <property name="use_underline">True</property>
-                <property name="xalign">0</property>
-                <property name="draw_indicator">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">6</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -260,16 +223,14 @@
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
                 <property name="margin_left">18</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
                 <property name="xalign">0</property>
                 <property name="draw_indicator">True</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
-                <property name="top_attach">6</property>
+                <property name="top_attach">9</property>
                 <property name="width">2</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -280,7 +241,6 @@
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
                 <property name="margin_left">18</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
                 <property name="xalign">0</property>
                 <property name="active">True</property>
@@ -289,8 +249,6 @@
               <packing>
                 <property name="left_attach">1</property>
                 <property name="top_attach">1</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -301,7 +259,6 @@
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
                 <property name="margin_left">18</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
                 <property name="xalign">0</property>
                 <property name="draw_indicator">True</property>
@@ -310,8 +267,6 @@
               <packing>
                 <property name="left_attach">1</property>
                 <property name="top_attach">2</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -322,7 +277,6 @@
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
                 <property name="margin_left">18</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
                 <property name="xalign">0</property>
                 <property name="draw_indicator">True</property>
@@ -331,8 +285,6 @@
               <packing>
                 <property name="left_attach">1</property>
                 <property name="top_attach">3</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -343,7 +295,6 @@
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
                 <property name="margin_left">18</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
                 <property name="xalign">0</property>
                 <property name="draw_indicator">True</property>
@@ -352,8 +303,6 @@
               <packing>
                 <property name="left_attach">1</property>
                 <property name="top_attach">4</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -364,7 +313,6 @@
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
                 <property name="margin_left">18</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
                 <property name="xalign">0</property>
                 <property name="draw_indicator">True</property>
@@ -373,8 +321,6 @@
               <packing>
                 <property name="left_attach">1</property>
                 <property name="top_attach">5</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -387,8 +333,6 @@
               <packing>
                 <property name="left_attach">2</property>
                 <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -399,7 +343,6 @@
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
                 <property name="margin_left">18</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
                 <property name="xalign">0</property>
                 <property name="active">True</property>
@@ -408,8 +351,6 @@
               <packing>
                 <property name="left_attach">2</property>
                 <property name="top_attach">1</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -419,8 +360,8 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Transpose the source during the paste so 
columns become rows and vice versa</property>
                 <property name="margin_left">18</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
                 <property name="xalign">0</property>
                 <property name="draw_indicator">True</property>
@@ -429,8 +370,6 @@
               <packing>
                 <property name="left_attach">2</property>
                 <property name="top_attach">2</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -440,8 +379,8 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Flip the source horizontally during the 
paste so the first column becomes the last and vice versa</property>
                 <property name="margin_left">18</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
                 <property name="xalign">0</property>
                 <property name="draw_indicator">True</property>
@@ -450,8 +389,6 @@
               <packing>
                 <property name="left_attach">2</property>
                 <property name="top_attach">3</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -461,8 +398,8 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Flip the source vertically during the paste 
so the first row becomes the last and vice versa</property>
                 <property name="margin_left">18</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
                 <property name="xalign">0</property>
                 <property name="draw_indicator">True</property>
@@ -471,8 +408,81 @@
               <packing>
                 <property name="left_attach">2</property>
                 <property name="top_attach">4</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSeparator" id="separator1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">6</property>
+                <property name="width">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="column-widths">
+                <property name="label" translatable="yes">Column widths</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Set column widths of the destination to 
those of the source</property>
+                <property name="margin_left">18</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">8</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="row-heights">
+                <property name="label" translatable="yes">Row heights</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Set row heights of the destination to those 
of the source</property>
+                <property name="margin_left">18</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">9</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="skip-blanks">
+                <property name="label" translatable="yes">Skip _Blanks</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">When the source of the paste is a blank 
cell, leave the target unchanged</property>
+                <property name="margin_left">18</property>
+                <property name="margin_top">6</property>
+                <property name="use_underline">True</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">8</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="Options">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">&lt;b&gt;Options&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">7</property>
               </packing>
             </child>
             <child>
diff --git a/src/item-cursor.c b/src/item-cursor.c
index 9724ff2..96c159c 100644
--- a/src/item-cursor.c
+++ b/src/item-cursor.c
@@ -765,7 +765,7 @@ item_cursor_do_action (GnmItemCursor *ic, ActionType action)
                        break;
                cmd_paste (wbc,
                           paste_target_init (&pt, sheet, &ic->pos,
-                                             PASTE_ALL_TYPES));
+                                             PASTE_ALL_CELL));
                break;
 
        case ACTION_MOVE_CELLS:
@@ -773,7 +773,7 @@ item_cursor_do_action (GnmItemCursor *ic, ActionType action)
                        break;
                cmd_paste (wbc,
                           paste_target_init (&pt, sheet, &ic->pos,
-                                             PASTE_ALL_TYPES));
+                                             PASTE_ALL_CELL));
                break;
 
        case ACTION_COPY_FORMATS:
diff --git a/src/selection.c b/src/selection.c
index de91460..7b74710 100644
--- a/src/selection.c
+++ b/src/selection.c
@@ -216,9 +216,9 @@ sv_is_colrow_selected (SheetView const *sv, int colrow, gboolean is_col)
  * sv_is_full_colrow_selected:
  * @sv:
  * @is_cols:
- * @index:
+ * @index: index of column or row, -1 for any.
  *
- * Returns: TRUE if all of the selected cols/rows in the selection
+ * Returns: %TRUE if all of the selected cols/rows in the selection
  *     are fully selected and the selection contains the specified col.
  **/
 gboolean
@@ -235,12 +235,12 @@ sv_is_full_colrow_selected (SheetView const *sv, gboolean is_cols, int index)
                if (is_cols) {
                        if (r->start.row > 0 || r->end.row < gnm_sheet_get_last_row (sv->sheet))
                                return FALSE;
-                       if (r->start.col <= index && index <= r->end.col)
+                       if (index == -1 || (r->start.col <= index && index <= r->end.col))
                                found = TRUE;
                } else {
                        if (r->start.col > 0 || r->end.col < gnm_sheet_get_last_col (sv->sheet))
                                return FALSE;
-                       if (r->start.row <= index && index <= r->end.row)
+                       if (index == -1 || (r->start.row <= index && index <= r->end.row))
                                found = TRUE;
                }
        }
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index a6ee36a..cd467d4 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -482,7 +482,7 @@ gnm_adjustment_configure (GtkAdjustment *adjustment,
 }
 
 /**
- * scg_scrollbar_config :
+ * scg_scrollbar_config:
  * @sc:
  *
  * Manages the scrollbar dimensions and paging parameters.
@@ -786,7 +786,7 @@ scg_init (SheetControlGUI *scg)
 /*************************************************************************/
 
 /**
- * gnm_pane_update_inital_top_left :
+ * gnm_pane_update_inital_top_left:
  * A convenience routine to store the new topleft back in the view.
  */
 static void
@@ -2055,38 +2055,38 @@ context_menu_handler (GnmPopupMenuElement const *element,
        g_return_if_fail (IS_SHEET (sheet));
 
        switch (element->index) {
-       case CONTEXT_CUT :
+       case CONTEXT_CUT:
                sv_selection_cut (sv, wbc);
                break;
-       case CONTEXT_COPY :
+       case CONTEXT_COPY:
                sv_selection_copy (sv, wbc);
                break;
-       case CONTEXT_PASTE :
+       case CONTEXT_PASTE:
                cmd_paste_to_selection (wbc, sv, PASTE_DEFAULT);
                break;
-       case CONTEXT_PASTE_SPECIAL :
+       case CONTEXT_PASTE_SPECIAL:
                dialog_paste_special (wbcg);
                break;
-       case CONTEXT_INSERT :
+       case CONTEXT_INSERT:
                dialog_insert_cells (wbcg);
                break;
-       case CONTEXT_DELETE :
+       case CONTEXT_DELETE:
                dialog_delete_cells (wbcg);
                break;
-       case CONTEXT_CLEAR_CONTENT :
+       case CONTEXT_CLEAR_CONTENT:
                cmd_selection_clear (wbc, CLEAR_VALUES);
                break;
-       case CONTEXT_FORMAT_CELL :
+       case CONTEXT_FORMAT_CELL:
                dialog_cell_format (wbcg, FD_CURRENT, 0);
                break;
-       case CONTEXT_FORMAT_CELL_COND :
+       case CONTEXT_FORMAT_CELL_COND:
                dialog_cell_format_cond (wbcg);
                break;
-       case CONTEXT_CELL_AUTOFIT_HEIGHT :
+       case CONTEXT_CELL_AUTOFIT_HEIGHT:
                workbook_cmd_autofit_selection
                        (wbc, wb_control_cur_sheet (wbc), FALSE);
                break;
-       case CONTEXT_CELL_AUTOFIT_WIDTH :
+       case CONTEXT_CELL_AUTOFIT_WIDTH:
                workbook_cmd_autofit_selection
                        (wbc, wb_control_cur_sheet (wbc), TRUE);
                break;
@@ -2105,30 +2105,30 @@ context_menu_handler (GnmPopupMenuElement const *element,
 
        }
                break;
-       case CONTEXT_COL_WIDTH :
+       case CONTEXT_COL_WIDTH:
                dialog_col_width (wbcg, FALSE);
                break;
-       case CONTEXT_COL_AUTOFIT :
+       case CONTEXT_COL_AUTOFIT:
                workbook_cmd_resize_selected_colrow
                        (wbc, wb_control_cur_sheet (wbc), TRUE, -1);
                break;
-       case CONTEXT_COL_HIDE :
+       case CONTEXT_COL_HIDE:
                cmd_selection_colrow_hide (wbc, TRUE, FALSE);
                break;
-       case CONTEXT_COL_UNHIDE :
+       case CONTEXT_COL_UNHIDE:
                cmd_selection_colrow_hide (wbc, TRUE, TRUE);
                break;
-       case CONTEXT_ROW_HEIGHT :
+       case CONTEXT_ROW_HEIGHT:
                dialog_row_height (wbcg, FALSE);
                break;
-       case CONTEXT_ROW_AUTOFIT :
+       case CONTEXT_ROW_AUTOFIT:
                workbook_cmd_resize_selected_colrow
                        (wbc, wb_control_cur_sheet (wbc), FALSE, -1);
                break;
-       case CONTEXT_ROW_HIDE :
+       case CONTEXT_ROW_HIDE:
                cmd_selection_colrow_hide (wbc, FALSE, FALSE);
                break;
-       case CONTEXT_ROW_UNHIDE :
+       case CONTEXT_ROW_UNHIDE:
                cmd_selection_colrow_hide (wbc, FALSE, TRUE);
                break;
        case CONTEXT_COMMENT_EDIT:
@@ -2165,14 +2165,14 @@ context_menu_handler (GnmPopupMenuElement const *element,
                g_free (name);
                break;
        }
-       case CONTEXT_DATA_SLICER_REFRESH :
+       case CONTEXT_DATA_SLICER_REFRESH:
                cmd_slicer_refresh (wbc);
                break;
-       case CONTEXT_DATA_SLICER_EDIT :
+       case CONTEXT_DATA_SLICER_EDIT:
                dialog_data_slicer (wbcg, FALSE);
                break;
 
-       default :
+       default:
                break;
        }
 }
@@ -2685,7 +2685,7 @@ cb_scg_object_unselect (SheetObject *so, G_GNUC_UNUSED double *coords, SheetCont
 }
 
 /**
- * scg_object_unselect :
+ * scg_object_unselect:
  * @scg: #SheetControlGUI
  * @so: #SheetObject (optionally NULL)
  *
@@ -2878,7 +2878,7 @@ cb_drag_selected_objects (SheetObject *so, double *coords, ObjDragInfo *info)
 }
 
 /**
- * scg_objects_drag :
+ * scg_objects_drag:
  * @scg: #SheetControlGUI
  * @primary: #SheetObject (optionally NULL)
  * @dx:
@@ -3180,7 +3180,7 @@ scg_comment_display_filter_cb (PangoAttribute *attribute, gboolean *state)
 }
 
 /**
- * scg_comment_display :
+ * scg_comment_display:
  * @scg: The SheetControl
  * @cc: A cell comment
  *
@@ -3290,7 +3290,7 @@ cb_cell_comment_timer (SheetControlGUI *scg)
 }
 
 /**
- * scg_comment_select :
+ * scg_comment_select:
  * @scg: The SheetControl
  * @cc: A cell comment
  *
@@ -3314,7 +3314,7 @@ scg_comment_select (SheetControlGUI *scg, GnmComment *cc, int x, int y)
 }
 
 /**
- * scg_comment_unselect :
+ * scg_comment_unselect:
  * @scg: The SheetControl
  * @cc: A cell comment
  *
@@ -3540,7 +3540,7 @@ scg_rangesel_stop (SheetControlGUI *scg, gboolean clear_string)
 }
 
 /**
- * scg_set_display_cursor :
+ * scg_set_display_cursor:
  * @scg:
  *
  * Set the displayed cursor type.
@@ -3699,7 +3699,7 @@ scg_cursor_move (SheetControlGUI *scg, int n,
 }
 
 /**
- * scg_cursor_extend :
+ * scg_cursor_extend:
  * @scg: The scg
  * @n: Units to extend the selection
  * @jump_to_bound: Move to transitions between cells and blanks,
@@ -4167,7 +4167,7 @@ scg_paste_cellregion (SheetControlGUI *scg, double x, double y,
        coords[0] = coords[2] = x;
        coords[1] = coords[3] = y;
        scg_object_coords_to_anchor (scg, coords, &anchor);
-       paste_target_init (&pt, sheet, &anchor.cell_bound, PASTE_ALL_TYPES);
+       paste_target_init (&pt, sheet, &anchor.cell_bound, PASTE_ALL_SHEET);
        if (content && ((content->cols > 0 && content->rows > 0) ||
                        content->objects != NULL))
                cmd_paste_copy (wbc, &pt, content);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]