[gnumeric] Fix background of multiple selection. [#789411]



commit bcce6d6815455094e1e8ba25c9f34e0c0215a768
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sun Oct 29 15:50:55 2017 +0100

    Fix background of multiple selection. [#789411]

 ChangeLog        |    6 ++++++
 NEWS             |    3 +++
 src/gnumeric.css |    4 ++++
 src/item-grid.c  |   11 +++--------
 4 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7e3ba4b..a109aa3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-10-29  Jean Brefort  <jean brefort normalesup org>
+
+       * src/gnumeric.css: add grid:selected back-color.
+       * src/item-grid.c (item_grid_draw_region): fix background of multiple
+       selection. [#789411]
+
 2017-10-23  Morten Welinder  <terra gnome org>
 
        * src/func.c (gnm_func_convert_markup_to_pango): Avoid dead kitten
diff --git a/NEWS b/NEWS
index e7f914b..eb9fc81 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@ Andreas:
        * Fix export/import of minor axis divisors to and from ODF.
        * Fix import of affice trendline from ODF. [#789538]
 
+Jean:
+       * Fix background of multiple selection. [#789411]
+
 Morten:
        * Convert all xpm files to png.
        * Avoid to-pixdata options for resources.  It's going away.
diff --git a/src/gnumeric.css b/src/gnumeric.css
index 29117fe..ba6aab8 100644
--- a/src/gnumeric.css
+++ b/src/gnumeric.css
@@ -28,6 +28,10 @@ GtkBin.auto-expr {
   border-width: 0;
 }
 
+GnmItemGrid:selected {
+  background-color: lavender;
+}
+
 /* Function markers are enabled from View->View Properties->Cell Markers */
 GnmItemGrid function-marker {
   color: #80ff80;
diff --git a/src/item-grid.c b/src/item-grid.c
index 93d2186..840ccb3 100644
--- a/src/item-grid.c
+++ b/src/item-grid.c
@@ -440,9 +440,7 @@ item_grid_draw_region (GocItem const *item, cairo_t *cr,
        WorkbookView *wbv = sv_wbv (sv);
        gboolean show_function_cell_markers = wbv->show_function_cell_markers;
        gboolean show_extension_markers = wbv->show_extension_markers;
-        /* we use the selected background color from an entry for selected cells */
-       GtkWidget *entry = gtk_entry_new ();
-       GtkStyleContext *ctxt = gtk_widget_get_style_context (entry);
+       GtkStyleContext *ctxt = goc_item_get_style_context (item);
 
        /* To ensure that far and near borders get drawn we pretend to draw +-2
         * pixels around the target area which would include the surrounding
@@ -521,13 +519,13 @@ item_grid_draw_region (GocItem const *item, cairo_t *cr,
        /* Fill entire region with default background (even past far edge) */
        cairo_save (cr);
        if (canvas->direction == GOC_DIRECTION_LTR)
-               gtk_render_background (goc_item_get_style_context (item),
+               gtk_render_background (ctxt,
                                       cr,
                                       x0 - canvas->scroll_x1 * scale,
                                       y0 - canvas->scroll_y1 * scale,
                                       width, height);
        else
-               gtk_render_background (goc_item_get_style_context (item),
+               gtk_render_background (ctxt,
                                       cr,
                                       canvas->width - x0 + canvas->scroll_x1 * scale - width,
                                       y0 - canvas->scroll_y1 * scale,
@@ -852,9 +850,6 @@ plain_draw : /* a quick hack to deal with 142267 */
                        ig_cairo_draw_bound (ig, cr, 1, start_y, 1, y);
        }
 
-       g_object_ref_sink (entry);
-       g_object_unref (entry);
-
        g_slist_free (merged_used);        /* merges with bottom in view */
        g_slist_free (merged_active_seen); /* merges with bottom the view */
        g_slist_free (merged_unused);      /* merges in hidden rows */


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