From 141a052a0e766d81903e0cc1690aa286238fc869 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Mon, 14 Jan 2008 23:30:00 +0000 Subject: [PATCH] Add preference so people can choose which behaviour they want. (bug 167422) --- src/display/canvas-grid.cpp | 16 ++++++++++++---- src/preferences-skeleton.h | 3 ++- src/ui/dialog/inkscape-preferences.cpp | 2 ++ src/ui/dialog/inkscape-preferences.h | 1 + 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 0edcbd0ab..b6897ae48 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -833,16 +833,24 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) gdouble const syg = floor ((buf->rect.y0 - ow[NR::Y]) / sw[NR::Y]) * sw[NR::Y] + ow[NR::Y]; gint const ylinestart = (gint) Inkscape::round((syg - ow[NR::Y]) / sw[NR::Y]); + //set correct coloring, depending preference (when zoomed out, always major coloring or minor coloring) + guint32 _empcolor; + bool preference = prefs_get_int_attribute ("options.grids", "no_emphasize_when_zoomedout", 0) == 1; + if( (scaled[NR::X] || scaled[NR::Y]) && preference ) { + _empcolor = color; + } else { + _empcolor = empcolor; + } + if (!render_dotted) { gint ylinenum; gdouble y; for (y = syg, ylinenum = ylinestart; y < buf->rect.y1; y += sw[NR::Y], ylinenum++) { gint const y0 = (gint) Inkscape::round(y); - if (!scaled[NR::Y] && (ylinenum % empspacing) != 0) { grid_hline (buf, y0, buf->rect.x0, buf->rect.x1 - 1, color); } else { - grid_hline (buf, y0, buf->rect.x0, buf->rect.x1 - 1, empcolor); + grid_hline (buf, y0, buf->rect.x0, buf->rect.x1 - 1, _empcolor); } } @@ -853,7 +861,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) if (!scaled[NR::X] && (xlinenum % empspacing) != 0) { grid_vline (buf, ix, buf->rect.y0, buf->rect.y1, color); } else { - grid_vline (buf, ix, buf->rect.y0, buf->rect.y1, empcolor); + grid_vline (buf, ix, buf->rect.y0, buf->rect.y1, _empcolor); } } } else { @@ -869,7 +877,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) if ( (!scaled[NR::X] && (xlinenum % empspacing) == 0) || (!scaled[NR::Y] && (ylinenum % empspacing) == 0) ) { - grid_dot (buf, ix, iy, empcolor | (guint32)0x000000FF); // put alpha to max value + grid_dot (buf, ix, iy, _empcolor | (guint32)0x000000FF); // put alpha to max value } else { grid_dot (buf, ix, iy, color | (guint32)0x000000FF); // put alpha to max value } diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 825bf37bd..f2b217fd4 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -246,7 +246,8 @@ static char const preferences_skeleton[] = " masks=\"65535\"/>\n" // 0x0000ffff " \n" " \n" -" " +" \n" "