[gnumeric] Misc cleanups.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Misc cleanups.
- Date: Tue, 26 Mar 2013 23:21:36 +0000 (UTC)
commit ad0f32942d46038f87f087b1dfe4302f659c53da
Author: Morten Welinder <terra gnome org>
Date: Tue Mar 26 19:21:17 2013 -0400
Misc cleanups.
src/gnumeric.css | 6 ++++
src/go-data-cache.c | 2 +-
src/item-cursor.c | 63 +++++++++++++--------------------------
src/sheet-object-cell-comment.c | 6 ++--
src/stf-export.c | 4 +-
5 files changed, 33 insertions(+), 48 deletions(-)
---
diff --git a/src/gnumeric.css b/src/gnumeric.css
index 267ea5d..eba3a75 100644
--- a/src/gnumeric.css
+++ b/src/gnumeric.css
@@ -2,6 +2,8 @@
/* The GnmItemGrid is the canvas area that holds all the cells. */
/* GnmPreviewGrid is the canvas used for auto-format previews. */
GnmItemGrid, GnmPreviewGrid {
+ /* The background must be solid and rectangular since we cheat and print
+ only parts of it. */
background-color: white;
padding: 0;
border-style: none;
@@ -24,6 +26,9 @@ GnmItemGrid pane-divider {
border-width: 1px;
}
+/* ------------------------------------------------------------------------- */
+/* The GnmItemCursor item is what marks a cell or selection on the sheet. */
+
/* The default cursor. */
GnmItemCursor.normal {
color: #000000;
@@ -43,6 +48,7 @@ GnmItemCursor.autofill {
background-color: black;
}
+/* ------------------------------------------------------------------------- */
/* GnmPane is the canvas we use for sheets. We store custom properties
here because there is no un-deprecated way to store them for the
diff --git a/src/go-data-cache.c b/src/go-data-cache.c
index 827b96a..ae9b0e4 100644
--- a/src/go-data-cache.c
+++ b/src/go-data-cache.c
@@ -145,7 +145,7 @@ go_data_cache_set_property (GObject *obj, guint property_id,
switch (property_id) {
case PROP_REFRESHED_BY :
g_free (cache->refreshed_by);
- cache->refreshed_by = g_strdup (g_value_get_string (value));
+ cache->refreshed_by = g_value_dup_string (value);
break;
case PROP_REFRESHED_ON :
go_val_free (cache->refreshed_on);
diff --git a/src/item-cursor.c b/src/item-cursor.c
index b644636..c6ce8bc 100644
--- a/src/item-cursor.c
+++ b/src/item-cursor.c
@@ -234,9 +234,9 @@ item_cursor_draw (GocItem const *item, cairo_t *cr)
GnmItemCursor *ic = GNM_ITEM_CURSOR (item);
int x0, y0, x1, y1; /* in widget coordinates */
GocPoint points[5];
- int i, draw_thick, draw_handle;
+ int i, draw_thick, draw_stippled, draw_handle;
int premove = 0;
- gboolean draw_stippled, draw_center, draw_external, draw_internal, draw_xor;
+ gboolean draw_center, draw_external, draw_internal, draw_xor;
double scale = item->canvas->pixels_per_unit;
GdkEventExpose *expose = (GdkEventExpose *) goc_canvas_get_cur_event (item->canvas);
GdkRGBA *fore = NULL, *back = NULL;
@@ -274,24 +274,26 @@ item_cursor_draw (GocItem const *item, cairo_t *cr)
draw_handle = 0;
draw_thick = 1;
draw_center = FALSE;
- draw_stippled = FALSE;
+ draw_stippled = 4;
draw_xor = TRUE;
switch (ic->style) {
case GNM_ITEM_CURSOR_AUTOFILL:
draw_center = TRUE;
draw_thick = 3;
- draw_stippled = TRUE;
+ draw_stippled = 1;
fore = &ic->autofill_color;
back = &ic->autofill_background_color;
+ draw_xor = FALSE;
break;
case GNM_ITEM_CURSOR_DRAG:
draw_center = TRUE;
draw_thick = 3;
- draw_stippled = TRUE;
+ draw_stippled = 1;
fore = &ic->drag_color;
back = &ic->drag_background_color;
+ draw_xor = FALSE;
break;
case GNM_ITEM_CURSOR_EXPR_RANGE:
@@ -457,44 +459,21 @@ item_cursor_draw (GocItem const *item, cairo_t *cr)
}
if (draw_center) {
- /* Stay in the boundary */
- if ((draw_thick % 2) == 0) {
- x0++;
- y0++;
- }
- if ((draw_thick % 1) == 1) {
- x0 += .5;
- y0 += .5;
- }
+ double dashes[2];
- if (draw_stippled) {
- GOPattern pat;
- double scalex = 1., scaley = 1.;
- cairo_pattern_t *cp;
- cairo_matrix_t mat;
- pat.fore = GO_COLOR_FROM_GDK_RGBA (*fore);
- pat.back = GO_COLOR_FROM_GDK_RGBA (*back);
- pat.pattern = GO_PATTERN_GREY50;
- cp = go_pattern_create_cairo_pattern (&pat, cr);
- cairo_user_to_device_distance (cr, &scalex, &scaley);
- cairo_matrix_init_scale (&mat, scalex, scaley);
- cairo_pattern_set_matrix (cp, &mat);
- cairo_set_source (cr, cp);
- cairo_pattern_destroy (cp);
- cairo_set_line_width (cr, draw_thick);
- cairo_rectangle (cr, x0, y0, abs (x1 - x0), abs (y1 - y0));
- cairo_stroke (cr);
- } else {
- double dashes[] = {4., 4.};
- cairo_set_dash (cr, dashes, 2, 0.);
- cairo_set_line_width (cr, draw_thick);
- gdk_cairo_set_source_rgba (cr, back);
- cairo_rectangle (cr, x0, y0, abs (x1 - x0), abs (y1 - y0));
- cairo_stroke_preserve (cr);
- cairo_set_dash (cr, dashes, 2, 4.);
- gdk_cairo_set_source_rgba (cr, fore);
- cairo_stroke (cr);
- }
+ /* Stay in the boundary */
+ x0 += (draw_thick / 2.0);
+ y0 += (draw_thick / 2.0);
+
+ dashes[0] = dashes[1] = draw_stippled;
+ cairo_set_dash (cr, dashes, 2, 0.);
+ cairo_set_line_width (cr, draw_thick);
+ gdk_cairo_set_source_rgba (cr, back);
+ cairo_rectangle (cr, x0, y0, abs (x1 - x0), abs (y1 - y0));
+ cairo_stroke_preserve (cr);
+ cairo_set_dash (cr, dashes, 2, dashes[1]);
+ gdk_cairo_set_source_rgba (cr, fore);
+ cairo_stroke (cr);
}
cairo_restore (cr);
}
diff --git a/src/sheet-object-cell-comment.c b/src/sheet-object-cell-comment.c
index 22ca4c0..d70f7f9 100644
--- a/src/sheet-object-cell-comment.c
+++ b/src/sheet-object-cell-comment.c
@@ -59,7 +59,7 @@ typedef struct {
GdkRGBA comment_indicator_color;
int comment_indicator_size;
} CommentView;
-typedef SheetObjectViewClass CommentViewClass;
+typedef SheetObjectViewClass CommentViewClass;
static GocItemClass *comment_view_parent_class;
static void
@@ -243,11 +243,11 @@ cell_comment_set_property (GObject *obj, guint param_id,
switch (param_id) {
case CC_PROP_TEXT:
g_free (cc->text);
- cc->text = g_strdup (g_value_get_string (value));
+ cc->text = g_value_dup_string (value);
break;
case CC_PROP_AUTHOR:
g_free (cc->author);
- cc->author = g_strdup (g_value_get_string (value));
+ cc->author = g_value_dup_string (value);
break;
case CC_PROP_MARKUP :
if (cc->markup != NULL)
diff --git a/src/stf-export.c b/src/stf-export.c
index 7ce2702..9649988 100644
--- a/src/stf-export.c
+++ b/src/stf-export.c
@@ -516,12 +516,12 @@ gnm_stf_export_set_property (GObject *object,
switch (property_id) {
case PROP_CHARSET:
- scopy = g_strdup (g_value_get_string (value));
+ scopy = g_value_dup_string (value);
g_free (stfe->charset);
stfe->charset = scopy;
break;
case PROP_LOCALE:
- scopy = g_strdup (g_value_get_string (value));
+ scopy = g_value_dup_string (value);
g_free (stfe->locale);
stfe->locale = scopy;
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]