diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-02-04 19:04:56 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-02-04 19:04:56 +0000 |
| commit | b47f28da767d37d5488c4e4cc11f96411cb54240 (patch) | |
| tree | d6d6736e671c77dfc71b8efa0f02d26af8d03f8d /src | |
| parent | r17853@shi: ted | 2008-02-04 09:54:45 -0800 (diff) | |
| download | inkscape-b47f28da767d37d5488c4e4cc11f96411cb54240.tar.gz inkscape-b47f28da767d37d5488c4e4cc11f96411cb54240.zip | |
fix emphasize coloring of grid lines (preference, dotted xy-grid and axonomgrid)
(bzr r4655)
Diffstat (limited to 'src')
| -rw-r--r-- | src/display/canvas-axonomgrid.cpp | 43 | ||||
| -rw-r--r-- | src/display/canvas-grid.cpp | 8 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 5 |
3 files changed, 33 insertions, 23 deletions
diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index e494ac9dd..79e301b73 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -1,7 +1,7 @@ #define CANVAS_AXONOMGRID_C /* - * Copyright (C) 2006-2007 Johan Engelen <johan@shouraizou.nl> + * Copyright (C) 2006-2008 Johan Engelen <johan@shouraizou.nl> */ /* @@ -9,8 +9,6 @@ * axes are bound to a certain range of angles. The z-axis always has an angle * smaller than 90 degrees (measured from horizontal, 0 degrees being a line extending * to the right). The x-axis will always have an angle between 0 and 90 degrees. - * When I quickly think about it: all possibilities are probably covered this way. Eg. - * a z-axis with negative angle can be replaced with an x-axis, etc. */ /* @@ -552,6 +550,15 @@ CanvasAxonomGrid::Update (NR::Matrix const &affine, unsigned int /*flags*/) void CanvasAxonomGrid::Render (SPCanvasBuf *buf) { + //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 && preference ) { + _empcolor = color; + } else { + _empcolor = empcolor; + } + // gc = gridcoordinates (the coordinates calculated from the grids origin 'grid->ow'. // sc = screencoordinates ( for example "buf->rect.x0" is in screencoordinates ) // bc = buffer patch coordinates @@ -581,10 +588,10 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) gint const x1 = x0 + (gint) Inkscape::round( (buf->rect.y1 - y) / tan_angle[X] ); gint const y1 = buf->rect.y1; - if (!scaled && (xlinenum % empspacing) == 0) { - sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, empcolor); - } else { + if (!scaled && (xlinenum % empspacing) != 0) { sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, color); + } else { + sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, _empcolor); } } // lines starting from top side @@ -596,10 +603,10 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) gint const x0 = (gint) Inkscape::round(x); gint const x1 = x0 + (gint) Inkscape::round( (y1 - y0) / tan_angle[X] ); - if (!scaled && (xlinenum % empspacing) == 0) { - sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, empcolor); - } else { + if (!scaled && (xlinenum % empspacing) != 0) { sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, color); + } else { + sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, _empcolor); } } @@ -610,10 +617,10 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) for (x = ystart_x_sc; x < buf->rect.x1; x += spacing_ylines, ylinenum++) { gint const x0 = (gint) Inkscape::round(x); - if (!scaled && (ylinenum % empspacing) == 0) { - sp_grid_vline (buf, x0, buf->rect.y0, buf->rect.y1 - 1, empcolor); - } else { + if (!scaled && (ylinenum % empspacing) != 0) { sp_grid_vline (buf, x0, buf->rect.y0, buf->rect.y1 - 1, color); + } else { + sp_grid_vline (buf, x0, buf->rect.y0, buf->rect.y1 - 1, _empcolor); } } @@ -629,10 +636,10 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) gint const x1 = x0 + (gint) Inkscape::round( (y - buf->rect.y0 ) / tan_angle[Z] ); gint const y1 = buf->rect.y0; - if (!scaled && (zlinenum % empspacing) == 0) { - sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, empcolor); - } else { + if (!scaled && (zlinenum % empspacing) != 0) { sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, color); + } else { + sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, _empcolor); } } // draw lines from bottom-up @@ -643,10 +650,10 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) gint const x0 = (gint) Inkscape::round(x); gint const x1 = x0 + (gint) Inkscape::round( (buf->rect.y1 - buf->rect.y0) / tan_angle[Z] ); - if (!scaled && (zlinenum % empspacing) == 0) { - sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, empcolor); - } else { + if (!scaled && (zlinenum % empspacing) != 0) { sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, color); + } else { + sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, _empcolor); } } } diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index f4f23764a..d31eb15c4 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -934,12 +934,12 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) gdouble x; for (x = sxg, xlinenum = xlinestart; x < buf->rect.x1; x += sw[NR::X], xlinenum++) { gint const ix = (gint) Inkscape::round(x); - if ( (!scaled[NR::X] && (xlinenum % empspacing) == 0) - || (!scaled[NR::Y] && (ylinenum % empspacing) == 0) ) + 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, color | (guint32)0x000000FF); // put alpha to max value } else { - grid_dot (buf, ix, iy, color | (guint32)0x000000FF); // put alpha to max value + grid_dot (buf, ix, iy, _empcolor | (guint32)0x000000FF); // put alpha to max value } } diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index efa461d55..a6927dc98 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -822,10 +822,13 @@ void InkscapePreferences::initPageCMS() void InkscapePreferences::initPageGrids() { - _page_grids.add_group_header( _("Default grid settings")); + _page_grids.add_group_header( _("Major grid line emphasizing")); _grids_no_emphasize_on_zoom.init( _("Don't emphasize gridlines when zoomed out"), "options.grids", "no_emphasize_when_zoomedout", false); _page_grids.add_line( false, "", _grids_no_emphasize_on_zoom, "", _("If set and zoomed out, the gridlines will be shown in normal color instead of major grid line color."), false); + + _page_grids.add_group_header( _("Default grid settings")); + _page_grids.add_line( false, "", _grids_notebook, "", "", false); _grids_notebook.append_page(_grids_xy, CanvasGrid::getName( GRID_RECTANGULAR )); _grids_notebook.append_page(_grids_axonom, CanvasGrid::getName( GRID_AXONOMETRIC )); |
